Module contents
Lesson 7 of 27Advanced 100 min

Sufficiency, exponential families and optimal unbiased estimation

Understand sufficient statistics and exponential families, derive moments and maximum-likelihood estimates from the log-partition function, and use Rao–Blackwell and Lehmann–Scheffé to improve unbiased estimators.

After this lesson you can

  • Use factorization and likelihood ratios to identify sufficient and minimal sufficient statistics.
  • Write exponential families in canonical form and derive moments and Fisher information from the log-partition function.
  • Explain when fixed-dimensional data compression is possible and why parameter-dependent support matters.
  • Apply Rao–Blackwell and Lehmann–Scheffé and recognize limitations of unbiased estimation.

Before you start

Motivation: compress data without losing anything about θ

Flip a coin a million times and store the entire sequence: one million bits. If you only want to estimate heads probability pp, must all be kept? Intuition says no: the number of heads suffices. Their order seems irrelevant. This lesson turns intuition into a theorem, finds each model’s smallest possible summary, and discovers that the answer depends on the model: if flips are not independent, head count no longer suffices.

The question has practical consequences:

  • Streaming and federated computation. If a fixed-dimensional summary (a sum or sum of squares) contains all parameter information, process data exceeding memory or aggregate many servers by summing vectors, losing nothing compared with having all data together.
  • Why some models are easy and others are not. In normal, Poisson, or logistic regression, maximum likelihood is a concave problem depending on few sums. For a Gaussian mixture or Cauchy model no summary is possible: each optimizer iteration scans all data and likelihood has local maxima. This frontier has a name: the exponential family.
  • Optimal estimators. If a summary contains all information, an estimator depending on more carries removable noise. Rao–Blackwell removes it and Lehmann–Scheffé certifies when none remains: the result is the minimum-variance unbiased estimator.

This lesson after the Cramér–Rao bound closes exact (nonasymptotic) point-estimation theory. It relies on conditional expectation, the tower property, and the law of total variance.

Sufficiency

Start with a statistical model {Pθ:θ∈Θ}\{P_\theta : \theta \in \Theta\} for full sample X=(X1,…,Xn)X = (X_1, \dots, X_n), with mass or density pθ(x)p_\theta(x). A statistic is any data function T(X)T(X) not depending on θ\theta.

The definition says something concrete: once TT is known, the remaining data are noise whose law is known without θ\theta. For the coin with Xi∼iidBern⁡(p)X_i \iid \Bern(p) and T=∑iXiT = \sum_i X_i, any sequence xx with tt heads satisfies

Pp(X=x∣T=t)=pt(1−p)n−t(nt)pt(1−p)n−t=1(nt).\Pr_p(X = x \given T = t) = \frac{p^t (1-p)^{n-t}}{\binom{n}{t} p^t (1-p)^{n-t}} = \frac{1}{\binom{n}{t}}.

Given the head count, all orders are equally likely, whatever pp. Order contains no information about pp.

Sufficiency belongs to a statistic-model pair, not the statistic alone. In the figure, independent flips make two sequences with equal head counts have equal likelihood; a model allowing dependence between consecutive flips does not.

InteractiveLossless compression for p
A
B
Relative likelihood L(p)/max⁡pL(p)L(p)/\max_p L(p) of each sequence
MLE
Log-likelihood difference ℓA(p)−ℓB(p)\ell_A(p) - \ell_B(p): flat if and only if curves above agree
  • sequence A
  • sequence B
  • ℓA−ℓB\ell_A - \ell_B
Sequence pair
0.00
Heads A | B8 | 8
Alternations A | B1 | 14
p^\hat p A | B0.400 | 0.400
Variation of ℓA−ℓB\ell_A - \ell_B0
Model sufficient statisticheads
Same number of heads (8) and constant ℓA−ℓB\ell_A - \ell_B: the sequences contain exactly the same information about pp.
Two 20-flip sequences (filled = heads); click a circle to change it. Above, each relative likelihood; below, log-likelihood difference. With κ=0\kappa = 0 (independence), A and B have 8 heads and curves coincide exactly: difference is line 0. Raise κ\kappa, introducing Markov dependence P(Xi+1=1∣Xi=x)=(1−κ)p+κx\Pr(X_{i+1} = 1 \given X_i = x) = (1 - \kappa)p + \kappa x: curves separate despite unchanged head count, because the grouped sequence has far fewer alternations. Try 'B = shuffled A' and 'Different' too.

In the figure’s Markov model, likelihood is px1(1−p)1−x1∏iq(xi)xi+1(1−q(xi))1−xi+1p^{x_1}(1-p)^{1-x_1}\prod_{i}q(x_i)^{x_{i+1}}(1 - q(x_i))^{1 - x_{i+1}} with q(x)=(1−κ)p+κxq(x) = (1 - \kappa)p + \kappa x. It depends on data via the first flip and transition counts (n00,n01,n10,n11)(n_{00}, n_{01}, n_{10}, n_{11}): that is now the sufficient summary. Grouped sequence A has one alternation and B fourteen; with κ>0\kappa > 0 this changes inference about pp.

Factorization theorem

Checking the definition requires a conditional distribution, generally awkward. The practical criterion examines likelihood’s form.

This is the factorization theorem. In the discrete case each direction takes one line, worked through in the final guided exercise: if TT is sufficient, pθ(x)=Pθ(T=T(x)) P(X=x∣T=T(x))p_\theta(x) = \Pr_\theta(T = T(x))\,\Pr(X = x \given T = T(x)) already factorizes; if factorized, conditioning cancels gθ(t)g_\theta(t). The density case needs measure theory (Halmos and Savage, 1949) without new ideas.

An immediate consequence: likelihood L(θ;x)=pθ(x)L(\theta; x) = p_\theta(x), as a function of θ\theta, is proportional to gθ(T(x))g_\theta(T(x)). Two samples with the same TT have proportional likelihoods and the MLE is always a function of any sufficient statistic. The figure’s flat difference shows this.

Minimal sufficiency

The entire sample XX is always sufficient (trivially), as is any bijection of a sufficient statistic. The interesting object is the smallest summary.

Proof

Prove the discrete case. Sufficiency. For each value tt of TT, choose representative yty_t with T(yt)=tT(y_t) = t. By assumption pθ(x)=c(x,yT(x)) pθ(yT(x))p_\theta(x) = c(x, y_{T(x)})\,p_\theta(y_{T(x)}) for every θ\theta. Define gθ(t)=pθ(yt)g_\theta(t) = p_\theta(y_t) and h(x)=c(x,yT(x))h(x) = c(x, y_{T(x)}): this factorizes, so TT is sufficient. Minimality. Let UU be another sufficient statistic and suppose U(x)=U(y)U(x) = U(y). By factorization of UU, pθ(x)/pθ(y)=hU(x)/hU(y)p_\theta(x)/p_\theta(y) = h_U(x)/h_U(y), independent of θ\theta, so by assumption T(x)=T(y)T(x) = T(y). Thus U(x)=U(y)⇒T(x)=T(y)U(x) = U(y) \Rightarrow T(x) = T(y), exactly stating that TT is a function of UU.

∎

The criterion turns search into algebra: write the ratio and inspect what must agree for θ\theta to cancel.

  • Bernoulli. pθ(x)/pθ(y)=(p/(1−p))tx−typ_\theta(x)/p_\theta(y) = \big(p/(1-p)\big)^{t_x - t_y} is free of pp if and only if tx=tyt_x = t_y. ∑Xi\sum X_i is minimal.
  • Uniform on (θ,θ+1)(\theta, \theta + 1). Likelihood is 1[x(n)−1≤θ≤x(1)]\ind[x_{(n)} - 1 \le \theta \le x_{(1)}], an interval indicator. The ratio is free of θ\theta if and only if the two intervals coincide: minimal is (X(1),X(n))(X_{(1)}, X_{(n)}), two numbers for a one-dimensional parameter.
  • Cauchy location. With density 1/(π(1+(x−θ)2))1/(\pi(1 + (x - \theta)^2)), ratio is ∏i(1+(yi−θ)2)/∏i(1+(xi−θ)2)\prod_i(1 + (y_i - \theta)^2)/\prod_i(1 + (x_i - \theta)^2), a ratio of degree-2n2n polynomials in θ\theta. It is constant if and only if the polynomials have the same complex roots xi±ix_i \pm i, meaning sets {xi}\{x_i\} and {yi}\{y_i\} agree. Minimal is the order statistics (X(1),…,X(n))(X_{(1)}, \dots, X_{(n)}): only arrival order can be discarded.
InteractiveWhen compression fails: normal versus Cauchy
Relative log likelihood ℓ(μ)−max⁡μℓ\ell(\mu) - \max_\mu \ell of location μ\mu
x̄
Data (drag)
  • normal model: −n2(μ−xˉ)2-\tfrac{n}{2}(\mu - \bar x)^2
  • Cauchy model: −∑ilog⁡(1+(xi−μ)2)-\sum_i \log(1 + (x_i - \mu)^2)
  • local maximum
nn | xˉ\bar x (normal MLE)5 | 0.18
Cauchy MLE3.97
Local maxima of Cauchy ℓ\ell3
Minimal sufficient dimension: normal | Cauchy1 | 5
Cauchy log likelihood has 3 local maxima: a local optimizer can get stuck at the wrong one.
Drag data in the lower strip (or press buttons). Above: relative log-likelihood of location μ\mu in normal (blue) and Cauchy (red) models. Normal is always the same parabola −n2(μ−xˉ)2-\tfrac{n}{2}(\mu - \bar x)^2: 'Separate extremes' moves two observations without changing xˉ\bar x and the blue curve stays fixed. Cauchy's changes with any movement and initially has three local maxima. Bring extremes together until one remains.

Exponential family

Nearly all models with fixed-dimensional sufficient statistics in preceding examples share a form. Uniform is an exception for a reason seen below.

Often a model has another parameter θ\theta and is written pθ(x)=h(x)exp⁡(η(θ)⊤T(x)−B(θ))p_\theta(x) = h(x)\exp(\eta(\theta)\T T(x) - B(\theta)). Convert to canonical form by changing variable to η=η(θ)\eta = \eta(\theta), advisable before differentiating.

FamilyT(x)T(x)η\etaA(η)A(\eta)h(x)h(x)N\mathcal{N}
Bern⁡(p)\Bern(p)xxlog⁡p1−p\log\frac{p}{1-p}log⁡(1+eη)\log(1 + e^\eta)11R\R
Bin⁡(m,p)\Bin(m, p), fixed mmxxlog⁡p1−p\log\frac{p}{1-p}mlog⁡(1+eη)m\log(1 + e^\eta)(mx)\binom{m}{x}R\R
Pois⁡(λ)\Pois(\lambda)xxlog⁡λ\log\lambdaeηe^\eta1/x!1/x!R\R
N(μ,1)\Normal(\mu, 1)xxμ\muη2/2\eta^2/2e−x2/2/2πe^{-x^2/2}/\sqrt{2\pi}R\R
N(μ,σ2)\Normal(\mu, \sigma^2)(x,x2)(x, x^2)(μσ2,−12σ2)\big(\frac{\mu}{\sigma^2}, -\frac{1}{2\sigma^2}\big)−η124η2−12log⁡(−2η2)-\frac{\eta_1^2}{4\eta_2} - \frac12\log(-2\eta_2)1/2π1/\sqrt{2\pi}R×(−∞,0)\R\times(-\infty, 0)
Exponential, rate β\betaxx−β-\beta−log⁡(−η)-\log(-\eta)11(−∞,0)(-\infty, 0)
Gamma(α,β)(\alpha, \beta)(log⁡x,x)(\log x, x)(α−1,−β)(\alpha - 1, -\beta)log⁡Γ(η1+1)−(η1+1)log⁡(−η2)\log\Gamma(\eta_1 + 1) - (\eta_1 + 1)\log(-\eta_2)11(−1,∞)×(−∞,0)(-1, \infty)\times(-\infty, 0)
Beta(a,b)(a, b)(log⁡x,log⁡(1−x))(\log x, \log(1-x))(a−1,b−1)(a - 1, b - 1)log⁡B(η1+1,η2+1)\log B(\eta_1 + 1, \eta_2 + 1)11(−1,∞)2(-1, \infty)^2
Categorical, KK classesex\vb{e}_x (one-hot)z\vb{z} (logits)log⁡∑jezj\log\sum_j e^{z_j}11RK\R^K

The last row is softmax: P(x=j)=ezj/∑lezl=exp⁡(z⊤ej−A(z))\Pr(x = j) = e^{z_j}/\sum_l e^{z_l} = \exp(\vb{z}\T\vb{e}_j - A(\vb{z})). This representation is not minimal because 1⊤ex=1\vb{1}\T\vb{e}_x = 1 always (adding a constant to all logits changes nothing); setting zK=0z_K = 0 gives a minimal one with K−1K - 1 parameters.

Uniform on (0,θ)(0, \theta) is not an exponential family: support depends on θ\theta, and no choice of hh, TT, and AA produces indicator 1[x≤θ]\ind[x \le \theta] with a finite exponent. Neither are Student’s tt with unknown degrees of freedom, Cauchy, or mixtures.

Fixed-dimensional sufficiency and convexity

For an iid sample from an exponential family,

pη(x1,…,xn)=(∏ih(xi))exp⁡(η⊤∑i=1nT(xi)−nA(η)),p_\eta(x_1, \dots, x_n) = \Big(\prod_i h(x_i)\Big)\exp\Big(\eta\T \sum_{i=1}^n T(x_i) - nA(\eta)\Big),

and factorization makes ∑iT(Xi)\sum_i T(X_i) sufficient. Its dimension is kk regardless of nn: a million gamma observations compress losslessly into two numbers. Under a minimal representation the ratio criterion shows it is also minimal: the ratio is exp⁡(η⊤(∑T(xi)−∑T(yi)))\exp(\eta\T(\sum T(x_i) - \sum T(y_i))) times an η\eta-free factor, and is independent of η\eta on an open set only if the difference is zero.

Proof

Let η1,η2∈N\eta_1, \eta_2 \in \mathcal{N} and α∈(0,1)\alpha \in (0, 1). Write the intermediate-point integrand as a product of powers and apply Hölder’s inequality with exponents 1/α1/\alpha and 1/(1−α)1/(1 - \alpha):

∫h e(αη1+(1−α)η2)⊤T=∫(h eη1⊤T)α(h eη2⊤T)1−α≤(∫h eη1⊤T)α(∫h eη2⊤T)1−α.\int h\, e^{(\alpha\eta_1 + (1 - \alpha)\eta_2)\T T} = \int \big(h\, e^{\eta_1\T T}\big)^{\alpha}\big(h\, e^{\eta_2\T T}\big)^{1 - \alpha} \le \Big(\int h\, e^{\eta_1\T T}\Big)^{\alpha}\Big(\int h\, e^{\eta_2\T T}\Big)^{1 - \alpha}.

Taking logarithms, A(αη1+(1−α)η2)≤αA(η1)+(1−α)A(η2)<∞A(\alpha\eta_1 + (1 - \alpha)\eta_2) \le \alpha A(\eta_1) + (1 - \alpha)A(\eta_2) < \infty: the intermediate point belongs to N\mathcal{N} and AA is convex. Equality in Hölder requires the two functions to be proportional, so e(η1−η2)⊤T(x)e^{(\eta_1 - \eta_2)\T T(x)} is constant on support, prohibited by minimality if η1≠η2\eta_1 \neq \eta_2.

∎

A second, more revealing proof follows: the Hessian of AA is a covariance matrix.

Moments by differentiating the log-partition

Proof

eA(η)=∫h eη⊤Te^{A(\eta)} = \int h\,e^{\eta\T T} is a Laplace transform. Near an interior point differentiation under the integral is allowed because ∣Tj∣meη⊤T\abs{T_j}^m e^{\eta\T T} is dominated by a combination of e(η±δej)⊤Te^{(\eta \pm \delta\vb{e}_j)\T T}, integrable for small δ\delta (dominated convergence). Differentiate A=log⁡∫h eη⊤TA = \log\int h\,e^{\eta\T T}:

∂A∂ηj=∫Tj h eη⊤T∫h eη⊤T=∫Tj h eη⊤T−A(η)=Eη[Tj].\pd{A}{\eta_j} = \frac{\int T_j\,h\,e^{\eta\T T}}{\int h\,e^{\eta\T T}} = \int T_j\,h\,e^{\eta\T T - A(\eta)} = \E_\eta[T_j].

Differentiating the middle expression again, ∂∂ηi(Tj h eη⊤T−A(η))=Tj(Ti−∂iA) h eη⊤T−A\pd{}{\eta_i}\big(T_j\,h\,e^{\eta\T T - A(\eta)}\big) = T_j(T_i - \partial_i A)\,h\,e^{\eta\T T - A}, so

∂2A∂ηi ∂ηj=Eη[TiTj]−Eη[Ti] Eη[Tj]=Cov⁡η[Ti,Tj].\frac{\partial^2 A}{\partial\eta_i\,\partial\eta_j} = \E_\eta[T_iT_j] - \E_\eta[T_i]\,\E_\eta[T_j] = \Cov_\eta[T_i, T_j].

For the cumulant generator, Eη[es⊤T]=∫h e(η+s)⊤T−A(η)=eA(η+s)−A(η)\E_\eta[e^{\vb{s}\T T}] = \int h\,e^{(\eta + \vb{s})\T T - A(\eta)} = e^{A(\eta + \vb{s}) - A(\eta)}.

∎

The Hessian matrix symmetry guaranteed by Schwarz’s theorem is covariance symmetry here. Since covariance is positive semidefinite, ∇2A⪰0\hess A \succeq 0: a second convexity proof. It is positive definite exactly when no combination a⊤T\vb{a}\T T is constant, which is minimality.

Everything depends on calculating AA. If TT is rich (e.g. outputs of a neural network), the defining integral for AA becomes intractable: the energy-based models of module 19. Identity ∇A=Eη[T]\grad A = \E_\eta[T] still holds, but expectation has no closed form and must be estimated by sampling from the model itself, making training expensive.

InteractiveThe log-partition knows everything
Log-partition A(η)A(\eta), tangent and osculating parabola
η
  • A(η)A(\eta)
  • tangent: slope =E[T]= \E[T]
  • parabola: curvature =Var⁡[T]= \Var[T]
Distribution of XX at this η\eta (Bernoulli)
  • mass p(x∣η)p(x \given \eta)
  • mean
  • mean ± standard deviation
Family
0.80
A(η)=log⁡(1+eη),p=σ(η)=0.690A(\eta) = \log(1 + e^{\eta}),\qquad p = \sigma(\eta) = 0.690
Slope A′(η)A'(\eta) (finite differences)0.6900
Mean Eη[T]\E_\eta[T] (summing distribution)0.6900
Curvature A′′(η)A''(\eta) (finite differences)0.2139
Variance Var⁡η[T]\Var_\eta[T] (summing distribution)0.2139
Fisher information I(η)=A′′(η)I(\eta) = A''(\eta)0.2139
Left: A(η)A(\eta) with its tangent at η\eta (orange) and osculating parabola (dashed). Right: distribution of XX at that η\eta with its mean and one standard deviation on each side, calculated by summing or integrating without differentiation. Readouts compare both: tangent slope matches mean and curvature matches variance in all four families. For exponential, watch AA diverge at natural-space boundary η=0\eta = 0. Then enable 'Fit data': line of slope Tˉ\bar T touches AA at one point, the MLE.

Fisher information and mean parameterization

Score in the natural parameter is especially simple: ∇ηlog⁡pη(x)=T(x)−∇A(η)\grad_\eta \log p_\eta(x) = T(x) - \grad A(\eta). Its covariance is Fisher information:

I(η)=Cov⁡η[T(X)]=∇2A(η).I(\eta) = \Cov_\eta[T(X)] = \hess A(\eta).

A finer point: observed information, −∇η2log⁡pη(x)=∇2A(η)-\hess_\eta \log p_\eta(x) = \hess A(\eta), does not depend on data: observed and expected coincide in natural parameters. Newton’s method and Fisher scoring are thus the same in these models (and generalized linear models with canonical link).

Since ∇A\grad A is the gradient of a strictly convex function (minimal case), η↦μ=∇A(η)\eta \mapsto \vb{\mu} = \grad A(\eta) is injective: mean vector μ=E[T]\vb{\mu} = \E[T] is another valid parameterization, the mean parameterization. Its Jacobian is ∂μ/∂η=∇2A\partial\vb{\mu}/\partial\eta = \hess A, and the information change-of-variable rule gives

I(μ)=(∂η∂μ)⊤I(η) ∂η∂μ=(∇2A)−1 ∇2A (∇2A)−1=Cov⁡[T]−1.I(\vb{\mu}) = \Big(\frac{\partial\eta}{\partial\vb{\mu}}\Big)\T I(\eta)\,\frac{\partial\eta}{\partial\vb{\mu}} = (\hess A)^{-1}\,\hess A\,(\hess A)^{-1} = \Cov[T]^{-1}.

Now estimator Tˉ=1n∑iT(Xi)\bar T = \frac1n\sum_i T(X_i): it is unbiased for μ\vb{\mu} with covariance Cov⁡[T]/n=(n I(μ))−1\Cov[T]/n = (n\,I(\vb{\mu}))^{-1}. It attains Cramér–Rao: an efficient estimator. The converse holds in dimension one: equality requires score affine in estimator, ∂θlog⁡pθ=a(θ)(δ(x)−g(θ))\partial_\theta\log p_\theta = a(\theta)(\delta(x) - g(\theta)), and integrating in θ\theta gives an exponential family with sufficient δ\delta. Finite-sample efficient estimators essentially exist only in exponential families, and only for affine functions of the mean parameter. This explains the previous lesson’s few exact efficiency examples.

MLE is moment matching

For an iid sample, log-likelihood in natural parameter is

ℓ(η)=η⊤∑i=1nT(xi)−nA(η)+∑ilog⁡h(xi),\ell(\eta) = \eta\T\sum_{i=1}^n T(x_i) - n A(\eta) + \sum_i\log h(x_i),

linear minus convex: concave. Its gradient is ∑iT(xi)−n∇A(η)\sum_i T(x_i) - n\grad A(\eta), and Hessian −n∇2A(η)-n\hess A(\eta).

Uniqueness comes from strict concavity: a critical point of a strictly concave function is its unique global maximum. Existence has real content: with 20 flips and 0 heads, Tˉ=0\bar T = 0 is at the boundary of [0,1][0, 1], and ℓ(η)=−20log⁡(1+eη)\ell(\eta) = -20\log(1 + e^\eta) strictly increases as η\eta decreases: it approaches supremum 0 as η→−∞\eta \to -\infty without attaining it at finite η\eta. The MLE of pp is 0, but the natural-parameter MLE does not exist. This is the statistical version of perfect separation in logistic regression.

The previous figure shows the geometry. Dividing by nn, ℓ(η)/n=ηTˉ−A(η)+cte\ell(\eta)/n = \eta\bar T - A(\eta) + \text{cte}: signed vertical distance between line ηTˉ\eta\bar T and curve AA. It is maximal where AA‘s tangent is parallel to the line, A′(η^)=TˉA'(\hat\eta) = \bar T. Maximum sup⁡η{ηTˉ−A(η)}\sup_\eta\{\eta\bar T - A(\eta)\} is the convex conjugate A∗(Tˉ)A^*(\bar T), equal to negative fitted-distribution entropy relative to base hh (ordinary entropy when h=1h = 1, as in Bernoulli or gamma): the exponential family solves the maximum entropy principle under E[T]\E[T] constraints, and this calculation is its other face.

Pitman–Koopman–Darmois: only the exponential family compresses

Do other models have fixed-dimensional sufficient statistics? With fixed support, essentially no.

Darmois (1935), Koopman (1936), and Pitman (1936) independently proved it; a precise statement and proof are in Lehmann and Casella, section 1.6. Consequences:

  • For Cauchy, Student’s tt, or logistic location, and mixtures with unknown components such as the Gaussian mixture, minimal sufficient statistics are order statistics. No fixed-size summary preserves all information.
  • Computationally, each optimizer or EM algorithm iteration must scan all data, and exact aggregation of different servers’ computations with a few sums is impossible. Concavity is lost too: the Cauchy figure had three local maxima with five observations.
  • Uniform escapes because its support depends on θ\theta. Thus it compresses into X(n)X_{(n)} without being exponential, and this section’s results (moments by differentiation, concavity, efficiency) do not apply.

Rao–Blackwell: conditioning on a sufficient statistic never worsens

If TT contains all information about θ\theta, an estimator depending on data beyond TT carries useless noise. Remove it by averaging within each level set of TT.

This is the Rao–Blackwell theorem, independently published by C. R. Rao (1945) and D. Blackwell (1947).

Proof

(1) Conditional expectation uses the law of XX given TT, independent of θ\theta by sufficiency. Without sufficiency, Eθ[δ∣T]\E_\theta[\delta \given T] would depend on unknown θ\theta and could not estimate. (2) Tower property: Eθ[E[δ∣T]]=Eθ[δ]\E_\theta[\E[\delta \given T]] = \E_\theta[\delta]. (3) For general convex loss, conditional Jensen gives L(θ,E[δ∣T])≤E[L(θ,δ)∣T]L(\theta, \E[\delta \given T]) \le \E[L(\theta, \delta) \given T]; taking expectations, Eθ[L(θ,δ∗)]≤Eθ[L(θ,δ)]\E_\theta[L(\theta, \delta^*)] \le \E_\theta[L(\theta, \delta)]. For squared error, total variance also yields the equality condition; the guided exercise proves it.

∎

Variance is reduced: by MSE decomposition and unchanged bias, gain is exactly Eθ[Var⁡(δ∣T)]\E_\theta[\Var(\delta \given T)], the variance δ\delta had inside TT‘s level sets.

Poisson P(X=0)\Pr(X = 0) example

With Xi∼iidPois⁡(λ)X_i \iid \Pois(\lambda), estimate g(λ)=P(X=0)=e−λg(\lambda) = \Pr(X = 0) = e^{-\lambda}, the probability of an interval without events. A ridiculously simple unbiased estimator looks only at the first observation: δ0=1[X1=0]\delta_0 = \ind[X_1 = 0]. It is 0 or 1, unbiased, and has variance e−λ(1−e−λ)e^{-\lambda}(1 - e^{-\lambda}), which does not decrease with nn.

Condition on S=∑iXiS = \sum_i X_i. Given S=sS = s, vector (X1,…,Xn)(X_1, \dots, X_n) is multinomial with ss trials and probabilities 1/n1/n (each of the ss events randomly falls into one of nn observations), so X1∣S=s∼Bin⁡(s,1/n)X_1 \given S = s \sim \Bin(s, 1/n) and

δ1=E[δ0∣S]=P(X1=0∣S)=(1−1n)S.\delta_1 = \E[\delta_0 \given S] = \Pr(X_1 = 0 \given S) = \Big(1 - \frac1n\Big)^S.

Generating function E[tS]=enλ(t−1)\E[t^S] = e^{n\lambda(t - 1)} calculates everything. With t=(n−1)/nt = (n-1)/n, E[δ1]=e−λ\E[\delta_1] = e^{-\lambda}: unbiased as required. With t=((n−1)/n)2t = ((n-1)/n)^2, E[δ12]=e−2λ+λ/n\E[\delta_1^2] = e^{-2\lambda + \lambda/n}, so

Var⁡(δ1)=e−2λ(eλ/n−1),cota de Crameˊr-Rao=g′(λ)2n/λ=λe−2λn.\Var(\delta_1) = e^{-2\lambda}\big(e^{\lambda/n} - 1\big), \qquad \text{cota de Cramér-Rao} = \frac{g'(\lambda)^2}{n/\lambda} = \frac{\lambda e^{-2\lambda}}{n}.

For λ=2\lambda = 2 and n=10n = 10: Var⁡(δ0)=0.1170\Var(\delta_0) = 0.1170, Var⁡(δ1)=0.004055\Var(\delta_1) = 0.004055 (29 times less), and the bound is 0.0036630.003663. Ratio (eλ/n−1)/(λ/n)=1.107(e^{\lambda/n} - 1)/(\lambda/n) = 1.107 is always above 1 and tends to 1: δ1\delta_1 never attains the bound for finite nn, consistent with e−λe^{-\lambda} not being affine in mean parameter λ\lambda. Yet soon we see no unbiased estimator does better.

InteractiveRao–Blackwell live
1200 of 4000 replicates: estimator value versus S=∑XiS = \sum X_i
g(λ) = 0.135
Its distribution
  • replicates
  • E[δ0∣S=s]=((n−1)/n)s\E[\delta_0 \given S = s] = ((n-1)/n)^s
  • diamonds: empirical mean of each column
  • estimator mean
  • ±1 standard deviation
t = 0.00
2.0
10
Estimator shownδ₀ = 1{X₁ = 0}
Mean of replicates | g(λ)=e−λg(\lambda) = e^{-\lambda}0.1348 | 0.1353
Variance of replicates0.1166
Var⁡(δ0)=e−λ(1−e−λ)\Var(\delta_0) = e^{-\lambda}(1 - e^{-\lambda})0.1170
Var⁡(δ1)=e−2λ(eλ/n−1)\Var(\delta_1) = e^{-2\lambda}(e^{\lambda/n} - 1)0.00406
Cramér–Rao bound λe−2λ/n\lambda e^{-2\lambda}/n0.00366
Reduction Var⁡(δ0)/Var⁡(δ1)\Var(\delta_0)/\Var(\delta_1) | efficiency of δ1\delta_1×28.9 | 90.3 %
Each point is a Poisson sample replicate (1200 of 4000 used by readouts): horizontal axis is its sum SS; vertical is estimator value. Initially δ0=1[X1=0]\delta_0 = \ind[X_1 = 0] is only 0 or 1. Play: each point slides to its column mean, curve ((n−1)/n)s((n-1)/n)^s; diamonds are empirical column means and lie on it. Right: estimator-value histogram on the same axis. Mean remains e−λe^{-\lambda} throughout animation (up to simulation noise, since both endpoints are unbiased) and variance falls around 29-fold to near Cramér–Rao. Change nn and λ\lambda.

Completeness and Lehmann–Scheffé

Rao–Blackwell improves estimators, but when is the best reached? If two different unbiased estimators were functions of TT, Rao–Blackwellization could not choose between them. Completeness prevents this.

  • Poisson. If Eλ[φ(S)]=e−nλ∑s≥0φ(s)(nλ)s/s!=0\E_\lambda[\varphi(S)] = e^{-n\lambda}\sum_{s \ge 0}\varphi(s)(n\lambda)^s/s! = 0 for all λ>0\lambda > 0, the power series ∑sφ(s)nsλs/s!\sum_s \varphi(s)n^s\lambda^s/s! is identically zero, and so are all its coefficients: φ≡0\varphi \equiv 0.
  • Exponential family. If the representation is minimal and N\mathcal{N} contains an open set, ∑iT(Xi)\sum_i T(X_i) is complete. The proof uses uniqueness of the Laplace transform (Lehmann and Casella, theorem 1.6.22).
  • Uniform on (0,θ)(0, \theta). If ∫0θφ(m) nmn−1θ−n ⁣dm=0\int_0^\theta \varphi(m)\,n m^{n-1}\theta^{-n}\dd m = 0 for every θ\theta, differentiating with respect to θ\theta yields φ(θ)θn−1=0\varphi(\theta)\theta^{n-1} = 0 for almost all θ\theta. X(n)X_{(n)} is complete.
  • A minimal sufficient statistic that is not complete. For the uniform distribution on (θ,θ+1)(\theta, \theta + 1), the range X(n)−X(1)X_{(n)} - X_{(1)} has a distribution independent of θ\theta (it is an ancillary statistic), with mean (n−1)/(n+1)(n-1)/(n+1). The function φ=X(n)−X(1)−(n−1)/(n+1)\varphi = X_{(n)} - X_{(1)} - (n-1)/(n+1) of (X(1),X(n))(X_{(1)}, X_{(n)}) has mean zero for every θ\theta without being identically zero.

“Uniformly” is the demanding part: one estimator must beat all others at every value of θ\theta simultaneously. The parameter θ\theta cannot select a different estimator. Surprisingly, with a complete sufficient statistic, this happens.

Proof

Let δ\delta be any unbiased finite-variance estimator of g(θ)g(\theta) and set δ∗=E[δ∣T]\delta^* = \E[\delta \given T]. By Rao–Blackwell, δ∗\delta^* is unbiased, is a function of TT, and Var⁡θ(δ∗)≤Var⁡θ(δ)\Var_\theta(\delta^*) \le \Var_\theta(\delta). Now δ∗−φ(T)\delta^* - \varphi(T) is a function of TT with Eθ[δ∗−φ(T)]=g(θ)−g(θ)=0\E_\theta[\delta^* - \varphi(T)] = g(\theta) - g(\theta) = 0 for every θ\theta; by completeness, δ∗=φ(T)\delta^* = \varphi(T) almost surely. Hence Var⁡θ(φ(T))=Var⁡θ(δ∗)≤Var⁡θ(δ)\Var_\theta(\varphi(T)) = \Var_\theta(\delta^*) \le \Var_\theta(\delta) for every θ\theta. If δ\delta were also a UMVUE, it would have the same variance as φ(T)=δ∗\varphi(T) = \delta^*, and the equality condition of Rao–Blackwell would give δ=δ∗=φ(T)\delta = \delta^* = \varphi(T) almost surely.

∎

The proof gives two recipes for finding the UMVUE: solve Eθ[φ(T)]=g(θ)\E_\theta[\varphi(T)] = g(\theta) directly for φ\varphi, or Rao–Blackwellize any simple unbiased estimator using a complete sufficient statistic. Thus:

  • Xˉ\bar X is the UMVUE of λ\lambda for Poisson and of μ\mu for the normal; S2=1n−1∑(Xi−Xˉ)2S^2 = \frac{1}{n-1}\sum(X_i - \bar X)^2 is the UMVUE of σ2\sigma^2.
  • ((n−1)/n)S((n-1)/n)^S is the UMVUE of e−λe^{-\lambda}: no unbiased estimator has lower variance, although it does not attain the Cramér–Rao bound. The bound is not the best attainable value, only a lower bound.
  • n+1nX(n)\frac{n+1}{n}X_{(n)} is the UMVUE of θ\theta for the uniform distribution.

The limits of pursuing unbiasedness

The UMVUE is optimal within a class that may be a poor choice.

It can be absurd. With one observation X∼Pois⁡(λ)X \sim \Pois(\lambda), estimate g(λ)=e−2λg(\lambda) = e^{-2\lambda} (the probability of no events in two intervals). An unbiased estimator δ\delta satisfies ∑xδ(x)e−λλx/x!=e−2λ\sum_x \delta(x)e^{-\lambda}\lambda^x/x! = e^{-2\lambda}, that is, ∑xδ(x)λx/x!=e−λ=∑x(−1)xλx/x!\sum_x\delta(x)\lambda^x/x! = e^{-\lambda} = \sum_x(-1)^x\lambda^x/x!. Matching coefficients, δ(X)=(−1)X\delta(X) = (-1)^X is the only unbiased estimator, and therefore the UMVUE. It estimates a probability using +1+1 or −1-1. Its MSE is 1−e−4λ1 - e^{-4\lambda}, equal to 0.9820.982 at λ=1\lambda = 1; the biased MLE e−2Xe^{-2X} has MSE 0.2790.279.

A biased estimator can beat it in MSE. In the estimators lesson you saw that, for the normal, dividing ∑(Xi−Xˉ)2\sum(X_i - \bar X)^2 by n+1n + 1 gives lower MSE than the UMVUE S2S^2. The same happens for the uniform: n+2n+1X(n)\frac{n+2}{n+1}X_{(n)} has MSE θ2/(n+1)2\theta^2/(n+1)^2, lower than the UMVUE’s θ2/(n(n+2))\theta^2/(n(n+2)) because n(n+2)=(n+1)2−1n(n+2) = (n+1)^2 - 1. Decision theory in lesson 23 takes this idea as far as the James–Stein estimator.

It may not exist. With X∼Bin⁡(n,p)X \sim \Bin(n, p), Ep[φ(X)]\E_p[\varphi(X)] is a polynomial in pp of degree at most nn, so 1/p1/p (or log⁡p\log p) has no unbiased estimator. Unbiasedness is not invariant either: if θ^\hat\theta is unbiased for θ\theta, g(θ^)g(\hat\theta) is almost never unbiased for g(θ)g(\theta), unlike the MLE, which is invariant.

Implementation from scratch

The first cell builds a generic exponential-family class from its symbolic log-partition function. SymPy differentiates AA and turns the derivatives into numerical functions; the MLE solves the moment equation ∇A(η)=Tˉ\grad A(\eta) = \bar T using scipy.optimize.root, passing the Hessian of AA as its Jacobian (exact Newton, as we saw). Finite differences provide an independent check.

[ ]ExponentialFamily class from scratchBrowser
import numpy as np
import sympy as sp
from scipy import optimize, special

class ExponentialFamily:
    """p(x | eta) = h(x) exp(eta · T(x) - A(eta)), con A dada como expresión de sympy."""

    def __init__(self, nombre, eta, A, T, log_h):
        self.nombre, self.eta = nombre, list(eta)
        self.k = len(self.eta)
        grad = [sp.diff(A, e) for e in self.eta]
        hess = [[sp.diff(g, e) for e in self.eta] for g in grad]
        mods = ["scipy", "numpy"]
        self._A = sp.lambdify(self.eta, A, mods)
        self._grad = sp.lambdify(self.eta, grad, mods)
        self._hess = sp.lambdify(self.eta, hess, mods)
        self.T, self.log_h = T, log_h            # T: x (n,) -> (n, k)

    def A(self, eta):
        return float(self._A(*eta))

    def mean(self, eta):                          # grad A = E[T]
        return np.array(self._grad(*eta), dtype=float)

    def cov(self, eta):                           # hess A = Cov[T]
        return np.array(self._hess(*eta), dtype=float).reshape(self.k, self.k)

    def mean_fd(self, eta, h=1e-5):               # comprobación: diferencias centradas
        eta = np.asarray(eta, float)
        E = np.eye(self.k) * h
        return np.array([(self.A(eta + E[j]) - self.A(eta - E[j])) / (2 * h) for j in range(self.k)])

    def loglik(self, eta, x):
        return float(np.sum(self.log_h(x)) + self.T(x).sum(axis=0) @ np.asarray(eta) - len(x) * self.A(eta))

    def fit(self, x, eta0):
        """EMV: resuelve grad A(eta) = media de T(x_i), con el hessiano como jacobiano."""
        tbar = self.T(x).mean(axis=0)
        sol = optimize.root(lambda e: self.mean(e) - tbar, eta0, jac=self.cov)
        return sol.x, sol.success

e, e1, e2 = sp.symbols("eta eta1 eta2")
familias = {
    "Bernoulli": ExponentialFamily("Bernoulli", [e], sp.log(1 + sp.exp(e)),
                                   lambda x: x[:, None], lambda x: np.zeros_like(x)),
    "Poisson": ExponentialFamily("Poisson", [e], sp.exp(e),
                                 lambda x: x[:, None], lambda x: -special.gammaln(x + 1)),
    "Gamma": ExponentialFamily("Gamma", [e1, e2], sp.loggamma(e1 + 1) - (e1 + 1) * sp.log(-e2),
                               lambda x: np.column_stack([np.log(x), x]), lambda x: np.zeros_like(x)),
    "Beta": ExponentialFamily("Beta", [e1, e2],
                              sp.loggamma(e1 + 1) + sp.loggamma(e2 + 1) - sp.loggamma(e1 + e2 + 2),
                              lambda x: np.column_stack([np.log(x), np.log1p(-x)]), lambda x: np.zeros_like(x)),
}

rng = np.random.default_rng(0)
n = 20_000
casos = {   # (muestra, parámetro natural verdadero, punto de partida del ajuste)
    "Bernoulli": (rng.binomial(1, 0.3, n).astype(float), [np.log(0.3 / 0.7)], [0.0]),
    "Poisson": (rng.poisson(4.0, n).astype(float), [np.log(4.0)], [0.0]),
    "Gamma": (rng.gamma(3.0, 1 / 2.0, n), [2.0, -2.0], [0.0, -1.0]),
    "Beta": (rng.beta(2.0, 5.0, n), [1.0, 4.0], [0.0, 0.0]),
}
for nombre, (x, eta_true, eta0) in casos.items():
    F = familias[nombre]
    Tx = F.T(x)
    print(f"{nombre}: eta verdadero = {np.round(eta_true, 4)}")
    print("   grad A (sympy)      :", np.round(F.mean(eta_true), 4))
    print("   grad A (dif. finitas):", np.round(F.mean_fd(eta_true), 4))
    print("   media muestral de T :", np.round(Tx.mean(axis=0), 4))
    print("   hess A              :", np.round(F.cov(eta_true), 4).ravel())
    print("   cov. muestral de T  :", np.round(np.atleast_2d(np.cov(Tx.T)), 4).ravel())
    eta_hat, ok = F.fit(x, eta0)
    print(f"   EMV eta = {np.round(eta_hat, 4)}  (convergió: {ok})")

All four families behave alike: the symbolic gradient, numerical gradient, and sample mean of TT agree up to Monte Carlo error, as do the Hessian and sample covariance. The MLE recovers the true natural parameter up to sampling error (with n=20 000n = 20\,000, on the order of a hundredth for Bernoulli and a few hundredths for beta). Notice that the class knows nothing about each family except AA, TT, and hh: all the theory in this lesson fits in those three functions.

The second cell measures the gains from Rao–Blackwell in the lesson’s two examples and compares them with the formulas: variances, Cramér–Rao bound, biased MLE e−Xˉe^{-\bar X} and, for the uniform, the biased estimator that beats the UMVUE in MSE. It also estimates E[δ0∣S=s]\E[\delta_0 \given S = s] by averaging δ0\delta_0 within each value of SS, literally the definition.

[ ]Rao–Blackwellization by simulationBrowser
import numpy as np

rng = np.random.default_rng(1)

# Poisson: estimar exp(-lambda) = P(X = 0)
lam, n, R = 2.0, 10, 200_000
X = rng.poisson(lam, size=(R, n))
S = X.sum(axis=1)
d0 = (X[:, 0] == 0).astype(float)            # estimador burdo
d1 = ((n - 1) / n) ** S                       # Rao-Blackwellizado = UMVUE
emv = np.exp(-X.mean(axis=1))                 # EMV, sesgado
g = np.exp(-lam)
crlb = lam * np.exp(-2 * lam) / n
print(f"g = exp(-lambda) = {g:.5f},  cota de Cramér-Rao = {crlb:.6f}")
for nombre, d, teo in [("delta0", d0, g * (1 - g)),
                       ("delta1", d1, np.exp(-2 * lam) * (np.exp(lam / n) - 1)),
                       ("EMV", emv, None)]:
    ecm = np.mean((d - g) ** 2)
    extra = f"  (teórica {teo:.6f})" if teo is not None else ""
    print(f"  {nombre:7s} media {d.mean():.5f}  varianza {d.var():.6f}{extra}  ECM {ecm:.6f}")

# E[delta0 | S = s] estimada promediando dentro de cada columna, frente a la fórmula
print("\n  s   media empírica de delta0   ((n-1)/n)^s   réplicas")
for s in range(14, 27, 3):
    sel = S == s
    print(f" {s:3d}        {d0[sel].mean():.4f}               {((n - 1) / n) ** s:.4f}     {sel.sum():6d}")

# Uniforme(0, theta): 2 X1 frente a su versión Rao-Blackwellizada
theta, n = 1.0, 5
U = rng.uniform(0, theta, size=(R, n))
M = U.max(axis=1)
for nombre, d, teo in [("2 X1", 2 * U[:, 0], theta**2 / 3),
                       ("(n+1)/n max", (n + 1) / n * M, theta**2 / (n * (n + 2))),
                       ("(n+2)/(n+1) max", (n + 2) / (n + 1) * M, theta**2 / (n + 1) ** 2)]:
    print(f"\n  {nombre:16s} media {d.mean():.4f}  ECM {np.mean((d - theta) ** 2):.5f}  (teórico {teo:.5f})", end="")
print()

Simulated variances agree with the formulas within Monte Carlo error (less than 0.5 %): the variance of δ1\delta_1 is about 29 times smaller than that of δ0\delta_0 and is 11 % above the bound. Column means reproduce ((n−1)/n)s((n-1)/n)^s, as the diamonds in the animation showed. The MLE e−Xˉe^{-\bar X} is biased upward (mean 0.1490.149 versus 0.1350.135; the exact value is enλ(e−1/n−1)e^{n\lambda(e^{-1/n} - 1)}), yet its MSE, 0.00460.0046, is only 13 % greater than that of the UMVUE. For the uniform distribution, the biased estimator n+2n+1X(n)\frac{n+2}{n+1}X_{(n)} beats the UMVUE in MSE, as predicted.

Finally, the counterexample: without an exponential family there is neither a summary nor concavity. With the five observations in the Cauchy figure, a local optimizer reaches different maxima depending on its starting point.

[ ]Cauchy: no fixed-dimensional sufficient statistic or concavityBrowser
import numpy as np
from scipy import optimize

x = np.array([-4.4, -3.7, 0.3, 4.0, 4.7])
nll = lambda m: np.sum(np.log1p((x - np.atleast_1d(m)[0]) ** 2))   # -log-verosimilitud (salvo constante)

mu = np.linspace(-8, 8, 3201)
ll = -np.array([nll(m) for m in mu])
picos = [mu[i] for i in range(1, len(mu) - 1) if ll[i] > ll[i - 1] and ll[i] >= ll[i + 1]]
print("máximos locales de la log-verosimilitud:", np.round(picos, 3))

for inicio in [-6.0, 0.0, 2.0, 6.0]:
    r = optimize.minimize(nll, x0=[inicio], method="BFGS")
    print(f"BFGS desde {inicio:+.1f} -> mu = {r.x[0]:+.3f},  log-verosimilitud = {-r.fun:.3f}")

# el modelo normal solo ve la media: cambiar los datos sin cambiar x̄ no cambia nada
y = x.copy(); y[0] -= 1.0; y[-1] += 1.0
print("\nmedias:", x.mean(), y.mean(), "  EMV normal igual; EMV de Cauchy:",
      round(optimize.minimize_scalar(nll, bounds=(-8, 8), method="bounded").x, 3), "frente a",
      round(optimize.minimize_scalar(lambda m: np.sum(np.log1p((y - m) ** 2)), bounds=(-8, 8), method="bounded").x, 3))

There are three local maxima, at −3.69-3.69, 0.340.34 and 3.983.98, and the last is global. None of the four BFGS starts finds it: three end at 0.340.34 and one at −3.69-3.69. When the extremes are moved apart without changing xˉ\bar x, the normal MLE stays unchanged while the Cauchy MLE moves from 3.9763.976 to 3.9393.939. In an exponential family none of this can occur: the log-likelihood is concave and only sees Tˉ\bar T.

The library version

scipy.stats fits any distribution by maximum likelihood using fit, optimizing numerically without knowing the family is exponential. For gamma and beta it should reach the same place as our moment equation (fixing location, and scale for beta, which are not parameters of the exponential family).

[ ]scipy.stats.fit versus the moment equationBrowser
import numpy as np
from scipy import stats

xg, eta_g, eta0_g = casos["Gamma"]
eta_hat, _ = familias["Gamma"].fit(xg, eta0_g)
a_sc, loc, escala = stats.gamma.fit(xg, floc=0)
print("Gamma   nuestra:  alfa = %.4f  beta = %.4f" % (eta_hat[0] + 1, -eta_hat[1]))
print("        scipy  :  alfa = %.4f  beta = %.4f" % (a_sc, 1 / escala))

xb, eta_b, eta0_b = casos["Beta"]
eta_hat_b, _ = familias["Beta"].fit(xb, eta0_b)
a_b, b_b, _, _ = stats.beta.fit(xb, floc=0, fscale=1)
print("Beta    nuestra:  a = %.4f  b = %.4f" % (eta_hat_b[0] + 1, eta_hat_b[1] + 1))
print("        scipy  :  a = %.4f  b = %.4f" % (a_b, b_b))

# la condición de primer orden: los momentos del suficiente cuadran
print("\nE[T] ajustada:", np.round(familias["Gamma"].mean(eta_hat), 6),
      "  media de T:", np.round(familias["Gamma"].T(xg).mean(axis=0), 6))

The two approaches agree to the first four digits, and the last line shows the condition characterizing the MLE: the fitted mean of T=(log⁡X,X)T = (\log X, X) exactly matches the observed one. In PyTorch, torch.distributions.ExponentialFamily is the base class of Bernoulli, Poisson, Gamma, Beta, Normal and others; each subclass declares _natural_params and _log_normalizer (our AA), and the base class calculates, for example, entropy by automatic differentiation of AA:

import torch
d = torch.distributions.Gamma(torch.tensor(3.0), torch.tensor(2.0))
eta = [p.detach().requires_grad_() for p in d._natural_params]   # (alfa - 1, -beta)
A = d._log_normalizer(*eta)
grad = torch.autograd.grad(A, eta)                                 # (E[log X], E[X])

Common mistakes

Exercises

QuizWhich models can be compressed?
For iid samples of arbitrary size nn, which of these models have a sufficient statistic of fixed dimension (not growing with nn)?

More than one answer may be correct.

QuizOne parameter, two numbers
With X1,…,Xn∼iidUnif⁡(θ,θ+1)X_1, \dots, X_n \iid \Unif(\theta, \theta + 1), what is a minimal sufficient statistic for θ\theta?
NumericVariance from curvature
For Bernoulli in canonical form, A(η)=log⁡(1+eη)A(\eta) = \log(1 + e^\eta). Calculate A′′(η)A''(\eta) at η=log⁡3\eta = \log 3.
QuizThe derivative that is not the mean
A colleague writes Poisson as p(x∣λ)=1x!exp⁡(xlog⁡λ−λ)p(x \given \lambda) = \frac{1}{x!}\exp(x\log\lambda - \lambda), differentiates B(λ)=λB(\lambda) = \lambda with respect to λ\lambda, and gets 1. They conclude that something is wrong with E[T]=∇A\E[T] = \grad A. What happened?
NumericThe UMVUE of the probability of zero
With X1,…,X10∼iidPois⁡(λ)X_1, \dots, X_{10} \iid \Pois(\lambda) you observe ∑iXi=15\sum_i X_i = 15. What is the UMVUE of e−λ=P(X=0)e^{-\lambda} = \Pr(X = 0)?
NumericHow far from the bound?
For Xi∼iidPois⁡(λ)X_i \iid \Pois(\lambda), with λ=2\lambda = 2 and n=10n = 10, calculate the ratio between the variance of the UMVUE ((n−1)/n)S((n-1)/n)^S of e−λe^{-\lambda} and the Cramér–Rao bound for estimating e−λe^{-\lambda}.
NumericThe uniform UMVUE
With X1,…,X4∼iidUnif⁡(0,θ)X_1, \dots, X_4 \iid \Unif(0, \theta) you observe x(4)=max⁡ixi=8x_{(4)} = \max_i x_i = 8. What is the UMVUE of θ\theta?
QuizAn embarrassing UMVUE
With a single observation X∼Pois⁡(λ)X \sim \Pois(\lambda), the only unbiased estimator of e−2λe^{-2\lambda} is (−1)X(-1)^X. Which conclusion is correct?
ProofThe factorization theorem, discrete case
Prove: Let XX be discrete with probability mass pθ(x)p_\theta(x) and let T=T(X)T = T(X) be a statistic. TT is sufficient for θ\theta if and only if there exist gθ≥0g_\theta \ge 0 and h≥0h \ge 0 with pθ(x)=gθ(T(x)) h(x)p_\theta(x) = g_\theta(T(x))\,h(x) for every xx and θ\theta.
0
Prove both implications.

Step 1 of 4. (⇒\Rightarrow) Suppose TT is sufficient. How do you obtain the factorization?

ProofRao–Blackwell using total variance
Prove: Let δ\delta be an estimator of g(θ)g(\theta) with Eθ[δ2]<∞\E_\theta[\delta^2] < \infty, TT sufficient, and δ∗=E[δ∣T]\delta^* = \E[\delta \given T]. Then Eθ[(δ∗−g(θ))2]≤Eθ[(δ−g(θ))2]\E_\theta[(\delta^* - g(\theta))^2] \le \E_\theta[(\delta - g(\theta))^2] for every θ\theta, with equality if and only if δ=δ∗\delta = \delta^* almost surely.
0
Fix θ\theta.

Step 1 of 5. Why is δ∗\delta^* a legitimate estimator?

CodeGamma as an exponential family
For X∼Gamma(α,β)X \sim \text{Gamma}(\alpha, \beta) (shape α\alpha, rate β\beta) with sufficient statistic T(x)=(log⁡x,x)T(x) = (\log x, x) and h(x)=1h(x) = 1, implement gamma_natural(alpha, beta), returning natural parameter η\eta as an array of shape (2,); gamma_A(eta), the closed-form log-partition A(η)=log⁡∫0∞eη1log⁡x+η2x dxA(\eta) = \log\int_0^\infty e^{\eta_1\log x + \eta_2 x}\,dx; and gamma_hess_A(eta), its closed-form 2×22\times 2 Hessian (use scipy.special.polygamma). Tests compare AA with numerical integration, the Hessian with finite differences of your AA, and with the sample covariance of (log⁡X,X)(\log X, X) in a large simulation.
import numpy as np
from scipy.special import gammaln, polygamma

def gamma_natural(alpha, beta):
  """Parámetro natural eta de Gamma(alpha, beta), beta = tasa, con T(x) = (log x, x)."""
  # tu código
  return np.zeros(2)

def gamma_A(eta):
  """Log-partición A(eta) en forma cerrada."""
  # tu código
  return 0.0

def gamma_hess_A(eta):
  """Hessiano de A en eta, en forma cerrada."""
  # tu código
  return np.zeros((2, 2))
Shift+Enter to run

Summary

Key idea
A sufficient statistic compresses data without losing anything about θ\theta; with fixed support, exponential families are the only models allowing fixed-dimensional compression, and their log-partition A(η)A(\eta) yields moments, Fisher information and the MLE by differentiation.
  • TT is sufficient if the law of XX given TT does not depend on θ\theta; the factorization theorem, pθ(x)=gθ(T(x))h(x)p_\theta(x) = g_\theta(T(x))h(x), checks this in practice. The likelihood-ratio criterion gives the minimal sufficient statistic, whose dimension need not equal the parameter’s.
  • In an exponential family h(x)exp⁡(η⊤T(x)−A(η))h(x)\exp(\eta\T T(x) - A(\eta)): ∑iT(Xi)\sum_i T(X_i) is sufficient with fixed dimension, AA is convex, ∇A=E[T]\grad A = \E[T], ∇2A=Cov⁡[T]=I(η)\hess A = \Cov[T] = I(\eta), and the MLE solves ∇A(η^)=Tˉ\grad A(\hat\eta) = \bar T, uniquely by convexity. Tˉ\bar T is efficient for the mean parameter.
  • By Pitman–Koopman–Darmois, outside these families (Cauchy, mixtures), the minimal sufficient statistic is the order statistics: no compression and generally no concavity.
  • Rao–Blackwell: E[δ∣T]\E[\delta \given T] preserves bias and does not increase MSE; the gain is E[Var⁡(δ∣T)]\E[\Var(\delta \given T)]. If TT is also complete, Lehmann–Scheffé says the unique unbiased function of TT is the UMVUE.
  • The UMVUE is not always desirable: it may be absurd, lose to biased estimators in MSE, or not exist. Unbiasedness is a constraint, not an objective.