Module contents
Lesson 6 of 27Core 95 min

Fisher information and the Cramér-Rao bound

Measure how much information an observation contains about a parameter. Prove score properties (zero mean and variance equal to information), both Fisher-information expressions and their matrix form, and the Cramér–Rao lower bound on variance of unbiased estimators. Interpret information as log-likelihood curvature and a metric leading to the natural gradient.

After this lesson you can

  • Prove that score has zero mean and variance equal to Fisher information under regularity conditions.
  • Calculate expected and observed Fisher information in scalar and multiparameter models, including the normal matrix.
  • Prove the Cramér–Rao bound and determine whether an estimator is efficient.
  • Transform information under reparameterization and add it for iid samples.
  • Identify when regularity fails (parameter-dependent support) and the bound does not apply.

Before you start

Motivation: how much data is needed?

You will measure a component’s failure rate pp and want to know its absolute precision. With nn independent tests, frequency p^=k/n\hat p = k/n has variance p(1−p)/np(1-p)/n, so a 95 %95\,\% interval with half-width δ\delta needs approximately n=1.962 p(1−p)/δ2n = 1.96^2\,p(1-p)/\delta^2 tests. For δ=0.01\delta = 0.01 this gives n≈9604n \approx 9604 when p=0.5p = 0.5 and only n≈381n \approx 381 when p=0.01p = 0.01. In absolute terms, estimating a parameter near the boundary is about 25 times cheaper.

But if relative precision matters (within 10 %10\,\% of the value), the calculation reverses: δ=0.1 p\delta = 0.1\,p requires about 385 tests at p=0.5p = 0.5 and 38 00038\,000 at p=0.01p = 0.01. The answer to “how much data?” depends on which parameter is measured and how much one observation teaches about it. The second quantity has a name and formula: Fisher information. This lesson defines and computes it, proves it sets a universal lower bound on variance of unbiased estimators (the Cramér–Rao bound), and explains when the bound is attained and when it cannot be applied.

The result matters outside classical statistics. Fisher information is local curvature of KL divergence between neighboring models, the natural metric on parameter space, the matrix preconditioning the m06 natural gradient, the weight Elastic Weight Consolidation uses to avoid forgetting tasks, and posterior Gaussian precision in the Laplace approximation. All follow from one identity: variance of the derivative of log-likelihood.

Score and its two properties

Work with a statistical model {f(⋅ ;θ):θ∈Θ}\{f(\cdot\,;\theta) : \theta \in \Theta\} with open Θ⊆R\Theta \subseteq \R (multiple parameters come below). For one observation XX, log-likelihood is ℓ(θ;x)=log⁡f(x;θ)\ell(\theta; x) = \log f(x; \theta) and its derivative is the score

s(θ;x)=∂∂θlog⁡f(x;θ)=1f(x;θ)∂f(x;θ)∂θ.s(\theta; x) = \pd{}{\theta}\log f(x;\theta) = \frac{1}{f(x;\theta)}\pd{f(x;\theta)}{\theta}.

Score evaluated at random variable XX is a random variable. It measures the direction and force with which the observation pushes the parameter. Conditions are needed for good behavior.

Condition 1 is the most forgotten and most consequential: if support moves with θ\theta, a boundary term appears in Leibniz’s rule and the next two properties cease to hold (as uniform shows at the end).

Proof

Since f(⋅ ;θ)f(\cdot\,;\theta) is a density, ∫f(x;θ)  ⁣dx=1\int f(x;\theta)\,\dd x = 1 for every θ\theta. Differentiate under the integral (condition 3):

0=∫∂f∂θ  ⁣dx=∫∂θff f  ⁣dx=Eθ[s(θ;X)],0 = \int \pd{f}{\theta}\,\dd x = \int \frac{\partial_\theta f}{f}\,f\,\dd x = \E_\theta[s(\theta;X)],

which is the first equality. For the second, differentiate ∫s f  ⁣dx=0\int s\,f\,\dd x = 0 again. By the product rule, ∂θ(sf)=(∂θs) f+s ∂θf=(∂θs) f+s2f\partial_\theta(s f) = (\partial_\theta s)\,f + s\,\partial_\theta f = (\partial_\theta s)\,f + s^2 f, using ∂θf=sf\partial_\theta f = s f. Integrating,

0=Eθ[∂θs]+Eθ[s2],∂θs=∂2∂θ2log⁡f.0 = \E_\theta[\partial_\theta s] + \E_\theta[s^2], \qquad \partial_\theta s = \pd{^2}{\theta^2}\log f.

Since Eθ[s]=0\E_\theta[s] = 0, Var⁡θ(s)=Eθ[s2]=−Eθ[∂θ2log⁡f]\Var_\theta(s) = \E_\theta[s^2] = -\E_\theta[\partial^2_\theta \log f].

∎

Interpretation: if data come from the model with the θ\theta evaluated, score is unbiased: on average, an observation pushes the parameter neither up nor down. Random score fluctuations have magnitude equal to mean log-likelihood curvature. The next figure makes this visible by plotting scores of many simulated samples.

InteractiveScore distribution
Score s(θ)/nI(θ0)s(\theta)/\sqrt{nI(\theta_0)} of the first 40 samples
θ₀
Histogram of s(θ)s(\theta) at evaluated θ\theta (600 samples)
  • sample score
  • empirical mean
  • theoretical mean and normal
Model
3.0
20
0.0
600 samples
Accumulated samples600
Score mean at evaluated θ\theta (simulated | theoretical), in nI\sqrt{nI} units0.072 | 0.000
Score variance at evaluated θ\theta (simulated | theoretical), same units1.040 | 1.000
At θ0\theta_0: simulated Var⁡(s)\operatorname{Var}(s) | mean of −ℓ′′-\ell'' | nI(θ0)nI(\theta_0)6.93 | 6.73 | 6.67
Each thin curve is score s(θ)s(\theta) of a sample simulated at true parameter θ0\theta_0 (black line), in units of nI(θ0)\sqrt{nI(\theta_0)}. Orange is the mean over accumulated samples, dashed is exact expectation, and blue band is expectation ±2\pm 2 standard deviations. With all 600 samples and δ=0\delta = 0, the right histogram is the score law at θ0\theta_0; where is its center and what is its variance relative to nInI? Move δ\delta: at another θ\theta the center shifts toward −δ-\delta (in those units) and spread changes. Play to watch mean and variance settle as samples accumulate, and see the last readout showing Var⁡(s)\operatorname{Var}(s) and mean −ℓ′′-\ell'' agree with nI(θ0)nI(\theta_0) in each of the three models.

Two readings. At θ0\theta_0 curves cross the horizontal axis distributed symmetrically and mean (orange) passes through zero: E[s]=0\E[s] = 0. Away from θ0\theta_0, mean score is nonzero, and the mean curve’s slope at θ0\theta_0 is −nI(θ0)-nI(\theta_0): that tilt lets likelihood “feel” a wrong parameter. A steep score quickly separates parameters; a shallow one confuses them.

Fisher information

Two useful interpretations. The variance form says I(θ)I(\theta) measures score agitation: a highly variable score discriminates parameter values well. The curvature form says −∂θ2log⁡f-\partial^2_\theta\log f is log-likelihood curvature and I(θ)I(\theta) its mean: a likelihood sharply peaked around truth locates it precisely. The next section’s first figure shows this.

Before continuing, examples used constantly. In each, I(θ)I(\theta) is information from one observation.

ModelParameterI(θ)I(\theta)
Bern⁡(p)\Bern(p)pp1p(1−p)\dfrac{1}{p(1-p)}
Pois⁡(λ)\Pois(\lambda)λ\lambda1λ\dfrac{1}{\lambda}
Exponential, rate λ\lambdaλ\lambda1λ2\dfrac{1}{\lambda^2}
N(μ,σ2)\Normal(\mu, \sigma^2), known σ\sigmaμ\mu1σ2\dfrac{1}{\sigma^2}
N(μ,σ2)\Normal(\mu, \sigma^2), known μ\muσ\sigma2σ2\dfrac{2}{\sigma^2}
Laplace, scale bb, locationμ\mu1b2\dfrac{1}{b^2}
Logistic, scale ss, locationμ\mu13s2\dfrac{1}{3s^2}
Cauchy, scale γ\gamma, locationμ\mu12γ2\dfrac{1}{2\gamma^2}

Observed information

Fisher information is an expectation: a model property at unknown true θ\theta. With data you have something different: curvature of your log-likelihood.

Both measure the same thing but are not equal: nI(θ)nI(\theta) promises an average over samples you could obtain; Jn(θ^)J_n(\hat\theta) is what this sample gave. Later you will see why observed information is often useful for standard errors. They agree, Jn(θ^)=nI(θ^)J_n(\hat\theta) = nI(\hat\theta), in exponential families and all their parameterizations: ℓn′′\ell_n'' depends on data only through the sufficient statistic, and the likelihood equation fixes it at its expectation under θ^\hat\theta. This occurs for Poisson (where Jn(λ^)=n/λ^J_n(\hat\lambda) = n/\hat\lambda) or normal in (μ,σ)(\mu, \sigma) at the MLE.

Curvature as precision

For Bernoulli data, the next figure plots ℓ(p)−ℓ(p^)\ell(p) - \ell(\hat p) for two parameter values at the same nn. The osculating parabola has the same curvature at the maximum, J=n/(p^(1−p^))J = n/(\hat p(1-\hat p)), and defines p^±1.96/J\hat p \pm 1.96/\sqrt{J}: precisely the interval obtained by dropping 1.92=1.962/21.92 = 1.96^2/2 units from a parabola’s maximum.

InteractiveCurvature is information
Left: p=0.50p = 0.50, n=200n = 200
drop 1.92
Right: p=0.010p = 0.010, n=200n = 200
drop 1.92
  • log likelihood ℓ(p)−ℓ(p^)\ell(p)-\ell(\hat p)
  • osculating parabola
  • true pp and Cramér–Rao band
200
0.50
0.010
Horizontal axis
Successes kk (left | right)101 | 2
Expected information per observation I(p)=1/(p(1−p))I(p)=1/(p(1-p)) (left | right)4.00 | 101.01
Observed information J=−ℓ′′(p^)J=-\ell''(\hat p) (left | right)800 | 20202
95 % interval width: parabola | C-R bound (left)0.139 | 0.139
95 % interval width: parabola | C-R bound (right)0.028 | 0.028
Width relative to pp (C-R bound; left | right)28 % | 276 %
Log-likelihood ℓ(p)−ℓ(p^)\ell(p)-\ell(\hat p) of a Bernoulli sample (blue) at the same nn and two pp values, osculating parabola at the maximum (orange dashed), and three 95% intervals: exact likelihood (drop 1.92, blue), parabola-implied (orange), and Cramér–Rao band at true pp (gray). On 'same scale' the p=0.01p = 0.01 panel is far narrower: information is 25 times greater. Switch to 'individual zoom' and reduce nn to tens: for p=0.01p = 0.01 the curve stops resembling a parabola and the implied interval leaves [0,1][0, 1]. At what nn do you trust the parabola? What does 'relative width' say?

At n=200n = 200, expected information is I(0.5)=4I(0.5) = 4 and I(0.01)=101I(0.01) = 101, a factor 25.2525.25. Interval width is proportional to 1/nI1/\sqrt{nI}: 0.1390.139 for p=0.5p = 0.5 and 0.0280.028 for p=0.01p = 0.01, a factor 25.25=5.02\sqrt{25.25} = 5.02. But width relative to pp is 28 %28\,\% in the first and 276 %276\,\% in the second: on the parameter’s own scale, 0.010.01 is poorly measured. Information depends on parameterization, as seen next.

Additivity and reparameterization

Proof

Sample score is Sn(θ)=∂θlog⁡∏ifi(xi;θ)=∑isi(θ;xi)S_n(\theta) = \partial_\theta\log\prod_i f_i(x_i;\theta) = \sum_i s_i(\theta; x_i), a sum of independent zero-mean variables. Variance of an independent sum is the sum of variances: Var⁡(Sn)=∑iVar⁡(si)=∑iIi(θ)\Var(S_n) = \sum_i \Var(s_i) = \sum_i I_i(\theta).

∎

Information grows linearly with data: each independent observation contributes. This is why the Cramér–Rao bound decreases as 1/n1/n.

Proof

By the chain rule, ∂φlog⁡f(x;h(φ))=sθ(h(φ);x) h′(φ)\partial_\varphi\log f(x; h(\varphi)) = s_\theta(h(\varphi); x)\,h'(\varphi). Factor h′(φ)h'(\varphi) is constant with respect to xx, so its square leaves the variance: Var⁡(sφ)=h′(φ)2 Var⁡(sθ)=h′(φ)2Iθ(h(φ))\Var(s_\varphi) = h'(\varphi)^2\,\Var(s_\theta) = h'(\varphi)^2 I_\theta(h(\varphi)).

∎

Information is not a number belonging to the model, but a measure of the parameter: it changes by the square of a scale-change factor. For Bernoulli with φ=log⁡p1−p\varphi = \log\frac{p}{1-p} (logit), p=1/(1+e−φ)p = 1/(1 + e^{-\varphi}) and  ⁣dp/ ⁣dφ=p(1−p)\dd p/\dd\varphi = p(1-p), so

Ilogit(φ)=1p(1−p) (p(1−p))2=p(1−p).I_{\text{logit}}(\varphi) = \frac{1}{p(1-p)}\,\big(p(1-p)\big)^2 = p(1-p).

On logit scale, information vanishes as p→0p \to 0: this is what the figure’s relative width expressed. With φ=arcsin⁡p\varphi = \arcsin\sqrt p, Iφ=4I_\varphi = 4 for every pp: a scale where precision is value-independent. This is the Bernoulli variance-stabilizing transformation, and square root of information determines Jeffreys prior in Bayesian inference.

Multiple parameters: the information matrix

Now θ∈Θ⊆Rp\theta \in \Theta \subseteq \R^p is open. Score is the gradient s(θ;x)=∇θlog⁡f(x;θ)∈Rp\vb{s}(\theta;x) = \grad_\theta\log f(x;\theta) \in \R^p. Regularity conditions apply componentwise, and both score properties are proved the same way: E[s]=0\E[\vb{s}] = \vb{0} and E[ss⊤]=−E[∇θ2log⁡f]\E[\vb{s}\vb{s}\T] = -\E[\hess_\theta\log f].

Immediate properties: symmetric and positive semidefinite, because a⊤Ia=Var⁡(a⊤s)≥0\vb{a}\T\mat{I}\vb{a} = \Var(\vb{a}\T\vb{s}) \ge 0 (positive definite matrix). It is positive definite if and only if no nonzero linear combination of score components is almost surely constant: if a⊤s=0\vb{a}\T\vb{s} = 0 almost surely, moving θ\theta in direction a\vb{a} does not change density to first order, so data do not distinguish that direction to first order. This typically signals local nonidentifiability, though it does not imply it: in N(θ3,1)\Normal(\theta^3, 1) information at θ=0\theta = 0 is zero but the model is identifiable (revisit identifiability in lesson 2). Additivity: In=nI\mat{I}_n = n\mat{I}. The Jacobian rule becomes matrix-valued.

Proof is the scalar one using multivariate chain rule: sφ=H⊤sθ\vb{s}_\varphi = \mat{H}\T\vb{s}_\theta and Cov⁡(H⊤s)=H⊤Cov⁡(s)H\Cov(\mat{H}\T\vb{s}) = \mat{H}\T\Cov(\vb{s})\mat{H}.

Normal in (μ,σ)(\mu, \sigma)

For X∼N(μ,σ2)X \sim \Normal(\mu, \sigma^2), log⁡f=−log⁡σ−(x−μ)22σ2−12log⁡2π\log f = -\log\sigma - \frac{(x-\mu)^2}{2\sigma^2} - \frac12\log 2\pi and, with Z=(X−μ)/σ∼N(0,1)Z = (X - \mu)/\sigma \sim \Normal(0,1),

sμ=Zσ,sσ=Z2−1σ.s_\mu = \frac{Z}{\sigma}, \qquad s_\sigma = \frac{Z^2 - 1}{\sigma}.

Then Iμμ=E[Z2]/σ2=1/σ2I_{\mu\mu} = \E[Z^2]/\sigma^2 = 1/\sigma^2, Iσσ=E[(Z2−1)2]/σ2=2/σ2I_{\sigma\sigma} = \E[(Z^2-1)^2]/\sigma^2 = 2/\sigma^2 (because E[Z4]=3\E[Z^4] = 3), and Iμσ=E[Z3−Z]/σ2=0I_{\mu\sigma} = \E[Z^3 - Z]/\sigma^2 = 0, because standard normal odd moments vanish. The matrix is diagonal:

I(μ,σ)=(1/σ2002/σ2).\mat{I}(\mu,\sigma) = \begin{pmatrix} 1/\sigma^2 & 0 \\ 0 & 2/\sigma^2\end{pmatrix}.

μ\mu and σ\sigma are called orthogonal parameters. Their statistical meaning is clear: inverse nIn\mat{I} is estimator asymptotic covariance and diagonal, so μ^\hat\mu and σ^\hat\sigma are asymptotically uncorrelated (for normal they are actually independent for every nn). Orthogonality is a parameterization property, not a model property.

The Jacobian rule quickly gives other parameterizations. With v=σ2v = \sigma^2,  ⁣dσ/ ⁣dv=1/(2σ)\dd\sigma/\dd v = 1/(2\sigma) and Ivv=2σ2⋅14σ2=12σ4I_{vv} = \frac{2}{\sigma^2}\cdot\frac{1}{4\sigma^2} = \frac{1}{2\sigma^4}. With τ=log⁡σ\tau = \log\sigma,  ⁣dσ/ ⁣dτ=σ\dd\sigma/\dd\tau = \sigma and Iττ=2I_{\tau\tau} = 2: a constant, because on log scale estimating a scale costs the same whatever its value. But switching to (q,σ)(q, \sigma) with q=μ+κσq = \mu + \kappa\sigma (e.g. a normal quantile), Jacobian H−1=(1κ01)\mat{H}\inv = \begin{pmatrix}1 & \kappa\\ 0 & 1\end{pmatrix} mixes coordinates and

I(q,σ)=1σ2(1−κ−κκ2+2),Corr⁡(q^,σ^)=κκ2+2.\mat{I}(q,\sigma) = \frac{1}{\sigma^2}\begin{pmatrix} 1 & -\kappa \\ -\kappa & \kappa^2 + 2\end{pmatrix}, \qquad \operatorname{Corr}(\hat q, \hat\sigma) = \frac{\kappa}{\sqrt{\kappa^2 + 2}}.

Estimated quantile and scale are correlated even though mean and scale are not. The next interactive displays this on the confidence ellipse.

InteractiveNormal information ellipse
95 % confidence region for (μ,σ)(μ, σ) with n=30n = 30
truth
  • ellipse (ϕ^−ϕ)⊤nI(ϕ)(ϕ^−ϕ)≤χ2,0.952(\hat\phi-\phi)^\top nI(\phi)(\hat\phi-\phi)\le\chi^2_{2,0.95}
  • exact image of (μ,σ)(\mu,\sigma) ellipse
  • simulated MLEs
Parameterization ϕ\phi
1.5
1.0
1.5
30
I(ϕ)=(0.4440.0000.0000.889)I(\phi)=\begin{pmatrix}0.444 & 0.000\\ 0.000 & 0.889\end{pmatrix}
Fisher information per observation
Asymptotic correlation of ϕ^1,ϕ^2\hat\phi_1,\hat\phi_20.000
det⁡J\det J | det⁡I(ϕ)\det I(\phi) | det⁡I(θ)/(det⁡J)2\det I(\theta)/(\det J)^21.000 | 0.395 | 0.395
Ellipse semiaxes in each coordinate0.670 | 0.474
MLEs inside ellipse (nominal 95 %)94.3 %
95% confidence region {ϕ:(ϕ^−ϕ)⊤ nI(ϕ) (ϕ^−ϕ)≤χ2,0.952}\{\phi : (\hat\phi - \phi)\T\,nI(\phi)\,(\hat\phi - \phi) \le \chi^2_{2,0.95}\} for a normal MLE, in four parameterizations (blue fill), with exact image of the (μ,σ)(\mu, \sigma) ellipse under reparameterization (gray line) and 300 simulated MLEs (orange points). With (μ,σ)(\mu, \sigma) the ellipse aligns with axes: parameters are orthogonal. Switch to (μ,σ2)(\mu, \sigma^2) and (μ,log⁡σ)(\mu, \log\sigma): alignment remains but the vertical semiaxis changes with det⁡J\det\mat{J}, where J=∂ϕ/∂(μ,σ)\mat{J} = \partial\phi/\partial(\mu,\sigma) is the forward Jacobian (inverse of text's H\mat{H}). Switch to (μ+κσ,σ)(\mu + \kappa\sigma, \sigma) and raise κ\kappa: ellipse tilts and correlation appears. For what nn do the ellipse and exact image differ? Compare det⁡I(ϕ)\det\mat{I}(\phi) with det⁡I(θ)/(det⁡J)2\det\mat{I}(\theta)/(\det\mat{J})^2.

Blue ellipse (quadratic, information-based) and gray line (exact image) agree to first order and separate when nn is small and transformation highly curved, such as σ↦log⁡σ\sigma \mapsto \log\sigma near 00. This is the delta method: Jacobian rule linearizes reparameterization.

Cramér–Rao bound

The central result: an unbiased estimator may have many variances, but not any variance; model information sets a floor.

Proof

Let Sn=∑is(θ;Xi)S_n = \sum_i s(\theta; X_i) be sample score, with E[Sn]=0\E[S_n] = 0 and Var⁡(Sn)=nI(θ)\Var(S_n) = nI(\theta). Differentiating g(θ)=∫Tfn  ⁣dxg(\theta) = \int T f_n\,\dd x under the integral,

g′(θ)=∫T ∂fn∂θ  ⁣dx=∫T Sn fn  ⁣dx=E[T Sn]=Cov⁡(T,Sn),g'(\theta) = \int T\,\pd{f_n}{\theta}\,\dd x = \int T\,S_n\,f_n\,\dd x = \E[T\,S_n] = \Cov(T, S_n),

the last equality because E[Sn]=0\E[S_n] = 0. Now Cauchy-Schwarz in L2L^2 (LpL^p spaces) for covariance: Cov⁡(T,Sn)2≤Var⁡(T) Var⁡(Sn)\Cov(T, S_n)^2 \le \Var(T)\,\Var(S_n). Therefore

g′(θ)2≤Var⁡(T)⋅nI(θ),g'(\theta)^2 \le \Var(T)\cdot nI(\theta),

which is the bound. ■\blacksquare

∎

The proof is short, but each step works. Equality Cov⁡(T,Sn)=g′(θ)\Cov(T, S_n) = g'(\theta) ties estimator sensitivity to the parameter to its correlation with score; Cauchy-Schwarz bounds that correlation by 11; and score variance is information. Bound 1/(nI)1/(nI) recovers the opening intuition: unbiased estimator standard error cannot fall below 1/nI(θ)1/\sqrt{nI(\theta)}.

Known bias. If TT has bias b(θ)=Eθ[T]−θb(\theta) = \E_\theta[T] - \theta, then g=θ+bg = \theta + b and the bound is Var⁡(T)≥(1+b′(θ))2/(nI)\Var(T) \ge (1 + b'(\theta))^2/(nI). With MSE, ECM⁡(T)≥b(θ)2+(1+b′(θ))2/(nI(θ))\operatorname{ECM}(T) \ge b(\theta)^2 + (1+b'(\theta))^2/(nI(\theta)). For example, in N(μ,σ2)\Normal(\mu, \sigma^2) with known σ\sigma, shrunk estimator T=cXˉT = c\bar X has b(μ)=(c−1)μb(\mu) = (c-1)\mu, b′=c−1b' = c - 1, and variance c2σ2/n=(1+b′)2/(nI)c^2\sigma^2/n = (1 + b')^2/(nI): it attains the biased bound. Biased estimators such as regularized ones are not subject to 1/(nI)1/(nI); they can go below it at the cost of bias.

Multiple parameters. If T\vb{T} estimates g(θ)∈Rq\vb{g}(\theta) \in \R^q with E[T]=g(θ)\E[\vb{T}] = \vb{g}(\theta) and Jacobian matrix D(θ)=∂g/∂θ∈Rq×p\mat{D}(\theta) = \partial\vb{g}/\partial\theta \in \R^{q\times p}, then in Loewner order,

Cov⁡θ(T)  ⪰  1n D(θ) I(θ)−1 D(θ)⊤,\Cov_\theta(\vb{T}) \;\succeq\; \frac{1}{n}\,\mat{D}(\theta)\,\mat{I}(\theta)\inv\,\mat{D}(\theta)\T,

meaning the difference is positive semidefinite.

Proof

The preceding argument gives Cov⁡(T,Sn)=D\Cov(\vb{T}, \vb{S}_n) = \mat{D} (q×pq\times p), and covariance of vector (T,Sn)(\vb{T}, \vb{S}_n) is positive semidefinite:

(Cov⁡(T)DD⊤nI)⪰0.\begin{pmatrix}\Cov(\vb{T}) & \mat{D} \\ \mat{D}\T & n\mat{I}\end{pmatrix} \succeq 0.

Since nI≻0n\mat{I} \succ 0, the block’s Schur complement is also positive semidefinite: Cov⁡(T)−D(nI)−1D⊤⪰0\Cov(\vb{T}) - \mat{D}(n\mat{I})\inv\mat{D}\T \succeq 0.

∎

One special case is constant use: estimating a single parameter θj\theta_j without knowing others, Var⁡(θ^j)≥[I−1]jj/n\Var(\hat\theta_j) \ge [\mat{I}\inv]_{jj}/n, and [I−1]jj≥1/Ijj[\mat{I}\inv]_{jj} \ge 1/I_{jj} (Cauchy-Schwarz in the I\mat{I} inner product). Not knowing other parameters costs information unless orthogonal: for normal (μ,σ)(\mu, \sigma), estimating μ\mu costs the same whether σ\sigma is known; for (q,σ)(q, \sigma) it does not.

Efficient estimators

This is the estimator lesson’s relative efficiency, taking the bound’s unattainable optimum as reference. When do efficient estimators exist? The bound’s proof says equality in Cauchy-Schwarz occurs when T−g(θ)T - g(\theta) is proportional to score.

Proof

Equality in Cauchy-Schwarz requires T−g(θ)=c(θ)SnT - g(\theta) = c(\theta)S_n almost surely; multiplying by SnS_n and taking expectations gives c(θ)=g′(θ)/(nI(θ))c(\theta) = g'(\theta)/(nI(\theta)), yielding the expression for SnS_n. For fixed x\vb{x}, integrate ∂θlog⁡fn=an(θ)(T(x)−g(θ))\partial_\theta\log f_n = a_n(\theta)(T(\vb{x}) - g(\theta)) with respect to θ\theta: log⁡fn(x;θ)=η(θ)T(x)−A(θ)+log⁡c(x)\log f_n(\vb{x};\theta) = \eta(\theta)T(\vb{x}) - A(\theta) + \log c(\vb{x}), where η′=an\eta' = a_n and A′=angA' = a_n g. Conversely, in an exponential family Sn=η′(θ)(T−Eθ[T])S_n = \eta'(\theta)(T - \E_\theta[T]), satisfying equality in Cauchy-Schwarz.

∎

Known examples follow: Xˉ\bar X is efficient for μ\mu in normal, for λ\lambda in Poisson (variance λ/n=1/(nI)\lambda/n = 1/(nI)), for pp in Bernoulli (variance p(1−p)/np(1-p)/n), and for exponential mean 1/λ1/\lambda. Cases with no efficient estimator follow too: the bound exists but none reaches it. For normal, S2S^2 is unbiased for σ2\sigma^2 with variance 2σ4/(n−1)2\sigma^4/(n-1), while the bound is 2σ4/n2\sigma^4/n: efficiency (n−1)/n(n-1)/n, e.g. 0.90.9 at n=10n = 10. Yet S2S^2 is the best possible unbiased estimator (proved in optimal estimators): the bound was unattainable. For exponential rate λ\lambda, unbiased estimator (n−1)/∑iXi(n-1)/\sum_i X_i of λ\lambda has variance λ2/(n−2)\lambda^2/(n-2) versus bound λ2/n\lambda^2/n.

The race

Although an efficient unbiased estimator may not exist, the MLE is asymptotically efficient: MLE asymptotic normality (lesson 8) says n(θ^−θ)→N(0,1/I(θ))\sqrt{n}(\hat\theta - \theta) \to \Normal(0, 1/I(\theta)), with limiting variance exactly the bound. Check three scale-11 location families: normal (I=1I = 1), Laplace (I=1I = 1), and logistic (I=1/3I = 1/3).

InteractiveRace toward the bound
Variance of each estimator versus nn (log-log)
bound 1/(nI)
Efficiency (bound / variance)
efficiency 1 (reaches bound)
  • mean
  • median
  • 20 % trimmed
  • MLE (= median)
  • Cramér–Rao bound
Location family
40
Bound 1/(nI)1/(nI) with n=40n=40, I=1I=10.0250
Efficiency of mean (limit 0.50)0.53 ± 0.02
Efficiency of median (limit 1.00)0.84 ± 0.03
Efficiency of 20 % trimmed mean (limit 0.77)0.78 ± 0.02
Efficiency of MLE (limit 1.00)0.84 ± 0.03
Simulated variance of four location estimators versus nn (left, log-log) and efficiency = bound/variance (right), 2000 replicates per nn with the same samples for all. Dotted lines on the right are asymptotic efficiency limits. For Laplace: who reaches the bound, and why does mean lose half? Switch to logistic: mean is no longer bad (91%), median loses, and only MLE reaches 1. For normal, mean is MLE: efficiency is 1 up to Monte Carlo noise (vertical bar is ±1 Monte Carlo error).

Exact asymptotic efficiency limits are below (with vmedia=σ2v_{\text{media}} = \sigma^2, vmediana=1/(4f(μ)2)v_{\text{mediana}} = 1/(4f(\mu)^2) and 20 %20\,\% trimmed mean computed by numerical integration; see previous lesson).

Familymeanmedian20% trimmedMLE
Normal112/π=0.6372/\pi = 0.6370.8740.87411 (mean)
Laplace0.50.5110.7710.77111 (median)
Logistic9/π2=0.9129/\pi^2 = 0.9120.750.750.9740.97411

(Logistic mean: vmedia=π2/3=3.290v_{\text{media}} = \pi^2/3 = 3.290 and per-observation bound 1/I=31/I = 3, so efficiency is 3/(π2/3)=9/π2=0.9123/(\pi^2/3) = 9/\pi^2 = 0.912.) Two observations about such results. Laplace median is MLE but at finite nn lies below the limit (simulated efficiency is ≈0.8\approx 0.8 at n=50n = 50) and converges slowly. Estimator ranking depends on family: no universal “best” except MLE, the only winner in all three.

When the bound fails: uniform

Let X1,…,Xn∼iidUnif⁡(0,θ)X_1, \dots, X_n \iid \Unif(0, \theta). Naively apply the formula: log⁡f=−log⁡θ\log f = -\log\theta on support, score s=−1/θs = -1/\theta (constant), and E[s2]=1/θ2\E[s^2] = 1/\theta^2. The “bound” would be θ2/n\theta^2/n. Compare two unbiased estimators of θ\theta from the previous lesson: 2Xˉ2\bar X, variance θ2/(3n)\theta^2/(3n), and corrected maximum n+1nX(n)\frac{n+1}{n}X_{(n)}, variance θ2n(n+2)\frac{\theta^2}{n(n+2)}. Both fall below the “bound”: first by factor 33, second by n+2n + 2.

InteractiveUniform breaks the bound
Variance of two unbiased θ\theta estimators versus nn
“bound” θ²/n2X̄: slope −1corrected max: −2
Sampling distribution with n=20n=20 and band ±“bound”\pm\sqrt{\text{“bound”}}
  • 2Xˉ2\bar X
  • corrected maximum
  • naive “bound” θ2/n\theta^2/n
  • band ±\pm square root of “bound”
  • true θ\theta
20
Naive “bound” θ2/n\theta^2/n0.05000
Var⁡(2Xˉ)\operatorname{Var}(2\bar X): simulated | exact θ2/(3n)\theta^2/(3n)0.01646 | 0.01667
Var⁡(n+1nX(n))\operatorname{Var}\big(\tfrac{n+1}{n}X_{(n)}\big): simulated | exact θ2/(n(n+2))\theta^2/(n(n+2))0.002172 | 0.002273
Corrected variance / “bound” (exact 1/(n+2)1/(n+2))0.0455
Score s=−1/θs=-1/\theta: E[s]E[s] | Var⁡(s)\operatorname{Var}(s) | E[s2]E[s^2]−1 | 0 | 1
Data Unif⁡(0,1)\Unif(0, 1). Left: exact variance (lines) and simulated (hollow circles) for two unbiased θ\theta estimators versus the 'bound' θ2/n\theta^2/n from 1/(nI)1/(nI) with I=E[s2]I = E[s^2]. Right: sampling distributions and band ±\pm square root of the bound. Both cross below it, corrected maximum with log-log slope −2-2: its error decreases as 1/n1/n, not 1/n1/\sqrt n. Move nn to see both slopes, and inspect the final readout, one-observation score (with θ=1\theta = 1): E[s]=−1/θ\E[s]=-1/\theta, Var⁡(s)=0\operatorname{Var}(s)=0, and E[s2]=1/θ2\E[s^2]=1/\theta^2, quantities that in a regular model would be 00, II, and II.

None contradicts the theorem because assumptions fail. With support [0,θ][0, \theta], Leibniz’s rule has a boundary term:

0=∂∂θ∫0θ1θ  ⁣dx=f(θ;θ)⏟= 1/θ+∫0θ∂f∂θ  ⁣dx=1θ+E[s],0 = \pd{}{\theta}\int_0^\theta \frac{1}{\theta}\,\dd x = \underbrace{f(\theta;\theta)}_{=\,1/\theta} + \int_0^\theta \pd{f}{\theta}\,\dd x = \frac{1}{\theta} + \E[s],

so E[s]=−1/θ≠0\E[s] = -1/\theta \neq 0, not zero. The three expressions equal under regularity are here E[s2]=1/θ2\E[s^2] = 1/\theta^2, Var⁡(s)=0\Var(s) = 0, and −E[∂θ2log⁡f]=−1/θ2-\E[\partial^2_\theta\log f] = -1/\theta^2: three different numbers. Information’s definition ceases to make sense, and so does the bound.

The deeper statistical reason: when support depends on parameter, an observation near the boundary cuts off θ\theta abruptly (the maximum is an exact lower bound for θ\theta), information never captured by the derivative. This is the estimator lesson phenomenon: corrected maximum variance falls as 1/n21/n^2 versus 1/n1/n for 2Xˉ2\bar X. “Nonregular” models are no expository whim: parameter-dependent supports occur in auctions, regime-change processes, and threshold models.

Information as a metric

A third geometric interpretation explains why this quantity reappears in optimization and ML.

Proof

By definition, KL⁡(fθ∥fθ+δ)=Eθ[log⁡f(X;θ)−log⁡f(X;θ+δ)]\KL(f_\theta\|f_{\theta+\delta}) = \E_\theta[\log f(X;\theta) - \log f(X;\theta+\delta)]. Taylor-expand log⁡f(X;θ+δ)\log f(X;\theta+\delta) in δ\delta (multivariate Taylor) through second order: log⁡f(X;θ)+δ⊤s+12δ⊤∇2log⁡f δ+o(∥δ∥2)\log f(X;\theta) + \delta\T\vb{s} + \frac12\delta\T\hess\log f\,\delta + o(\norm{\delta}^2). Taking expectation, linear term is δ⊤E[s]=0\delta\T\E[\vb{s}] = 0 and quadratic is 12δ⊤E[∇2log⁡f]δ=−12δ⊤Iδ\frac12\delta\T\E[\hess\log f]\delta = -\frac12\delta\T\mat{I}\delta. The KL minus sign leaves +12δ⊤Iδ+\frac12\delta\T\mat{I}\delta.

∎

The information matrix defines a metric: “infinitesimal distance” between neighboring model distributions is  ⁣ds2= ⁣dθ⊤I(θ)  ⁣dθ\dd s^2 = \dd\theta\T\mat{I}(\theta)\,\dd\theta (Fisher–Rao metric), invariant under reparameterization by the Jacobian rule. With one observation, two parameters at Fisher distance much below 11 are barely distinguishable; with nn observations, uncertainty radius is order 1/n1/\sqrt{n} in this metric, as the bound says. Check numerically below.

This foreshadows two algorithms. The m06 natural gradient replaces steepest descent in Rp\R^p with steepest descent in this metric: Δθ=−η I(θ)−1∇L(θ)\Delta\theta = -\eta\,\mat{I}(\theta)\inv\grad\Loss(\theta), making the step independent of parameterization (m07). Fisher scoring replaces Newton–Raphson’s observed Hessian by expected information, θt+1=θt+(nI(θt))−1 Sn(θt)\theta_{t+1} = \theta_t + \big(n\mat{I}(\theta_t)\big)\inv\,\vb{S}_n(\theta_t) with Sn\vb{S}_n sample score, the engine of generalized linear models.

Implementation from scratch

Start with observed information. Approximate second derivative of log-likelihood with central differences: ℓ′′(θ)≈[ℓ(θ+h)−2ℓ(θ)+ℓ(θ−h)]/h2\ell''(\theta) \approx [\ell(\theta+h) - 2\ell(\theta) + \ell(\theta-h)]/h^2, and each Hessian cross element with the four-point formula. Step hh is the important choice: too large and truncation error ∼h2\sim h^2 dominates; too small and subtraction of nearly equal numbers divided by h2h^2 destroys digits. Default h∝εmaˊq1/4max⁡(∣θ∣,1)h \propto \eps_{\text{máq}}^{1/4}\max(\abs{\theta}, 1) balances errors; measure effect on Poisson with n=1000n = 1000, exact J=n/λ^J = n/\hat\lambda.

[ ]Observed information by finite differences, and step sizeBrowser
import numpy as np
from scipy.special import gammaln

def hessiano_fd(f, theta, h=None):
    """Hessiano de f en theta por diferencias centrales de segundo orden."""
    theta = np.asarray(theta, dtype=float)
    p = theta.size
    if h is None:                                     # eps^(1/4) escalado: equilibra truncamiento y redondeo
        h = np.finfo(float).eps ** 0.25 * np.maximum(np.abs(theta), 1.0)
    h = np.broadcast_to(h, theta.shape).astype(float)
    H = np.zeros((p, p))
    f0 = f(theta)
    for i in range(p):
        ei = np.zeros(p); ei[i] = h[i]
        H[i, i] = (f(theta + ei) - 2 * f0 + f(theta - ei)) / h[i] ** 2
        for j in range(i + 1, p):
            ej = np.zeros(p); ej[j] = h[j]
            H[i, j] = H[j, i] = (f(theta + ei + ej) - f(theta + ei - ej) - f(theta - ei + ej) + f(theta - ei - ej)) / (4 * h[i] * h[j])
    return H

def info_observada(loglik, theta_hat, h=None):
    return -hessiano_fd(loglik, theta_hat, h)

rng = np.random.default_rng(1)
x = rng.poisson(4.0, size=1000)
ll_pois = lambda th: np.sum(x * np.log(th[0]) - th[0] - gammaln(x + 1))
lam = x.mean()                                        # el EMV de la Poisson
exacta = len(x) / lam
print(f"EMV = {lam:.4f}; J exacta n/lambda = {exacta:.6f}")
print(f"{'paso h':>8} {'J':>14} {'error relativo':>15}")
for h in (1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8):
    J = info_observada(ll_pois, [lam], h=np.array([h]))[0, 0]
    print(f"{h:8.0e} {J:14.6f} {abs(J - exacta) / exacta:15.2e}")

# la normal en (mu, sigma): en el EMV la matriz es diagonal y vale (n/s^2, 2n/s^2)
y = rng.normal(1.0, 2.0, size=500)
def ll_norm(th):
    mu, s = th
    return np.sum(-np.log(s) - 0.5 * np.log(2 * np.pi) - (y - mu) ** 2 / (2 * s**2))
mh, sh = y.mean(), y.std()
print("\nnormal: J numérica\n", np.round(info_observada(ll_norm, [mh, sh]), 4))
print("normal: (n/s^2, 2n/s^2) =", round(len(y) / sh**2, 4), round(2 * len(y) / sh**2, 4))

Relative error traces a U: minimum near h=10−3h = 10^{-3} (error ≈3⋅10−8\approx 3\cdot 10^{-8}), growing as h2h^2 toward the table’s left and shooting up at right. At h=10−8h = 10^{-8} subtraction f(θ+h)−2f(θ)+f(θ−h)f(\theta+h) - 2f(\theta) + f(\theta-h) of numbers order 10310^{3} gives zero by rounding: “information” is zero. At h=10−7h = 10^{-7} it is 29 %29\,\% too low; a slightly worse step can give negative, meaningless as curvature of a maximum. This is the fourth common mistake below.

Now expected information as score variance, estimated by Monte Carlo with scores from central differences of one observation’s log-density. This is the definition’s variance form. Test on gamma with shape k=3k = 3 and scale 22, exact matrix (ψ′(k)1/θ1/θk/θ2)\begin{pmatrix}\psi'(k) & 1/\theta\\ 1/\theta & k/\theta^2\end{pmatrix} with trigamma ψ′\psi'.

[ ]Expected information: Monte Carlo score varianceBrowser
import numpy as np
from scipy.special import gammaln, polygamma

def scores_fd(logf, theta, xs, h=1e-5):
    """Matriz (len(xs), p) con el score de cada observación, por diferencias centrales."""
    theta = np.asarray(theta, dtype=float)
    S = np.zeros((len(xs), theta.size))
    for i in range(theta.size):
        e = np.zeros(theta.size); e[i] = h
        S[:, i] = (logf(theta + e, xs) - logf(theta - e, xs)) / (2 * h)
    return S

def info_mc(logf, theta, sampler, R=20_000, seed=0):
    xs = sampler(np.random.default_rng(seed), R)
    S = scores_fd(logf, theta, xs)
    return S.mean(axis=0), np.cov(S.T)               # media del score (debe ser 0) y su covarianza

# Poisson(4): I = 1/4
lf_pois = lambda th, xs: xs * np.log(th[0]) - th[0] - gammaln(xs + 1)
m, I = info_mc(lf_pois, [4.0], lambda g, R: g.poisson(4.0, R))
print(f"Poisson: media del score = {m[0]:+.4f}; I = {I.item():.4f} (exacta 0.25)")

# Normal(1, 2^2) en (mu, sigma): I = diag(1/4, 1/2)
lf_norm = lambda th, xs: -np.log(th[1]) - 0.5 * np.log(2 * np.pi) - (xs - th[0]) ** 2 / (2 * th[1] ** 2)
m, I = info_mc(lf_norm, [1.0, 2.0], lambda g, R: g.normal(1.0, 2.0, R))
print("normal: media del score =", np.round(m, 4), "\n", np.round(I, 4), "(exacta diag(0.25, 0.5))")

# Gamma(k=3, escala 2): matriz NO diagonal
k0, t0 = 3.0, 2.0
lf_gam = lambda th, xs: -gammaln(th[0]) - th[0] * np.log(th[1]) + (th[0] - 1) * np.log(xs) - xs / th[1]
m, I = info_mc(lf_gam, [k0, t0], lambda g, R: g.gamma(k0, t0, R))
exacta = np.array([[polygamma(1, k0), 1 / t0], [1 / t0, k0 / t0**2]])
print("gamma: media del score =", np.round(m, 4), "\n", np.round(I, 4), "\nexacta\n", np.round(exacta, 4))

At R=20 000R = 20\,000 Monte Carlo error of each element is order I2/R≈1 %I\sqrt{2/R} \approx 1\,\%: simulated matrices match exact to that precision and mean score is zero within noise (a few hundredths expected). Note gamma: the matrix is not diagonal. Shape and scale correlate because for fixed mean kθk\theta, greater shape is offset by lower scale. (An exercise asks you to diagonalize it.)

Symbolic form avoids simulation. With sympy differentiate the log-density Hessian and calculate its expectation. For Poisson, −∂2log⁡f-\partial^2\log f is linear in xx, so substitute xx by its mean; for normal use central moments E[tk]=σk(k−1)!!\E[t^k] = \sigma^k(k-1)!! for even kk and 00 for odd kk. Verify the Jacobian rule for v=σ2v = \sigma^2 in two ways: transform the matrix and calculate it directly.

[ ]Symbolic Fisher information with sympy and the Jacobian ruleBrowser
import sympy as sp

x, lam, mu, sg, v, t = sp.symbols("x lambda mu sigma v t", positive=True)

# Poisson: la segunda derivada es lineal en x, la esperanza sustituye x por su media
logf = x * sp.log(lam) - lam - sp.loggamma(x + 1)
print("Poisson: I(lambda) =", sp.simplify((-sp.diff(logf, lam, 2)).subs(x, lam)))

def esperanza_normal(expr, mu_, s_):
    """E[expr(X)] con X ~ N(mu_, s_^2): se expande en t = x - mu_ y se usan los momentos de la normal."""
    P = sp.Poly(sp.expand(expr.subs(x, mu_ + t)), t)
    return sp.simplify(sum(c * (0 if m[0] % 2 else s_ ** m[0] * sp.factorial2(m[0] - 1)) for m, c in P.terms()))

logn = -sp.log(sg) - (x - mu) ** 2 / (2 * sg**2) - sp.log(2 * sp.pi) / 2
I_ms = (-sp.hessian(logn, (mu, sg))).applyfunc(lambda e: esperanza_normal(e, mu, sg))
print("normal en (mu, sigma): I =", I_ms.tolist())

# regla del jacobiano: theta = (mu, sigma) = h(mu, v) con sigma = sqrt(v)
Hm = sp.Matrix([[1, 0], [0, 1 / (2 * sp.sqrt(v))]])
I_regla = (Hm.T * I_ms.subs(sg, sp.sqrt(v)) * Hm).applyfunc(sp.simplify)
logv = logn.subs(sg, sp.sqrt(v))
I_directa = (-sp.hessian(logv, (mu, v))).applyfunc(lambda e: esperanza_normal(e, mu, sp.sqrt(v)))
print("en (mu, v) por la regla:  ", I_regla.tolist())
print("en (mu, v) directamente: ", I_directa.tolist())
print("iguales:", sp.simplify(I_regla - I_directa) == sp.zeros(2, 2))

The two (μ,v)(\mu, v) matrices, diag⁡(1/v, 1/(2v2))\operatorname{diag}(1/v,\, 1/(2v^2)), agree, verifying the two-parameter Jacobian rule.

The next experiment shows why observed information is more than a noisy estimate of expected information. Take Cauchy location (scale 11, I=1/2I = 1/2, so nI=n/2nI = n/2) with n=20n = 20. Search for the MLE on a grid and refine by Newton, calculate Jn(θ^)J_n(\hat\theta) per sample, and group samples into three thirds by JJ.

[ ]Cauchy: observed information predicts this sample's errorBrowser
import numpy as np

rng = np.random.default_rng(11)
n, R = 20, 1500
x = rng.standard_cauchy((R, n))
med = np.median(x, axis=1)
grid = np.linspace(-3, 3, 121)
cand = med[:, None] + grid[None, :]                                  # (R, G) candidatos
ll = -np.log1p((x[:, None, :] - cand[:, :, None]) ** 2).sum(axis=2)  # log-verosimilitud en la rejilla
m = cand[np.arange(R), ll.argmax(axis=1)]
for _ in range(6):                                                    # refinamiento de Newton
    u = x - m[:, None]
    s = (2 * u / (1 + u**2)).sum(axis=1)                              # score de la muestra
    H = (-2 * (1 - u**2) / (1 + u**2) ** 2).sum(axis=1)               # segunda derivada de l
    m = m - s / H
u = x - m[:, None]
J = (2 * (1 - u**2) / (1 + u**2) ** 2).sum(axis=1)                    # información observada en el EMV

print(f"n I = {n / 2:.1f} (esperada); J observada: media {J.mean():.2f}, mín {J.min():.2f}, máx {J.max():.2f}")
print(f"varianza del EMV = {np.mean(m**2):.4f}; cota 1/(nI) = {2 / n:.4f}")
q = np.quantile(J, [1 / 3, 2 / 3])
for nombre, msk in [("J baja ", J <= q[0]), ("J media", (J > q[0]) & (J <= q[1])), ("J alta ", J > q[1])]:
    print(f"{nombre}: J media {J[msk].mean():5.2f} | error cuadrático medio del EMV {np.mean(m[msk] ** 2):.4f} | 1/J medio {np.mean(1 / J[msk]):.4f}")

Expected information says all samples of size 2020 have the same precision 1/(nI)=0.11/(nI) = 0.1. Observed information fluctuates from ≈1.7\approx 1.7 to ≈23\approx 23 and separates samples: when JJ is low, MLE mean squared error is around 0.160.16, and when high, 0.080.08, with each third near 1/J1/J. For an MLE lacking a sufficient statistic absorbing all information, curvature of this log-likelihood measures precision of this estimate better than the average over unseen samples. This is Efron and Hinkley’s (1978) argument and why practical standard errors use observed information.

Finally, geometry: KL between two neighboring Bernoullis versus 12I(p)δ2\frac12 I(p)\delta^2.

[ ]Local KL is Fisher informationBrowser
import numpy as np

def kl_bern(p, q):
    return p * np.log(p / q) + (1 - p) * np.log((1 - p) / (1 - q))

p = 0.3
I = 1 / (p * (1 - p))
print(f"{'delta':>8} {'KL(p || p+delta)':>18} {'I delta^2 / 2':>15} {'cociente':>10}")
for d in (0.1, 0.03, 0.01, 0.003):
    kl, apr = kl_bern(p, p + d), 0.5 * I * d**2
    print(f"{d:8.3f} {kl:18.3e} {apr:15.3e} {kl / apr:10.4f}")

The ratio tends to 11 as δ→0\delta \to 0: Fisher information is KL curvature.

Empirical efficiency of estimators

Using the estimator lesson’s ADEMP framework, turn the race figure into a simulation study. Aims: which location estimator reaches the bound and how much do others lose? D: three mechanisms, normal, Laplace, logistic, scale 11 and n=50n = 50. E: center 00. M: mean, median, 20 %20\,\% trimmed mean, and MLE (logistic solved by vectorized Newton as in the interactive). P: efficiency = =\,bound//variance with Monte Carlo error; for variance estimated as mean of er2e_r^2, relative error is (E[e4]/E[e2]2−1)/R\sqrt{(\E[e^4]/\E[e^2]^2 - 1)/R}.

[ ]Empirical efficiency versus the Cramér–Rao boundBrowser
import numpy as np
from scipy import stats

def mle_logistica(x, it=12):
    """EMV de la localización logística (escala 1): Newton sobre el score sum(tanh((x - m)/2)) = 0."""
    m = np.median(x, axis=1)
    for _ in range(it):
        t = np.tanh((x - m[:, None]) / 2)
        m = m + t.sum(axis=1) / (0.5 * (1 - t**2)).sum(axis=1)
    return m

FAMILIAS = {   # nombre: (generador con centro 0, información de Fisher por observación)
    "normal":    (lambda g, s: g.standard_normal(s), 1.0),
    "laplace":   (lambda g, s: g.laplace(0, 1, s), 1.0),
    "logistica": (lambda g, s: g.logistic(0, 1, s), 1 / 3),
}
n, R = 50, 4000
for i, (nombre, (gen, I)) in enumerate(FAMILIAS.items()):
    x = gen(np.random.default_rng([2024, n, i]), (R, n))   # las mismas muestras para todos los métodos
    est = {"media": x.mean(1), "mediana": np.median(x, 1), "recort.20%": stats.trim_mean(x, 0.2, axis=1)}
    est["EMV"] = x.mean(1) if nombre == "normal" else np.median(x, 1) if nombre == "laplace" else mle_logistica(x)
    cota = 1 / (n * I)
    print(f"{nombre}: cota 1/(nI) = {cota:.5f}")
    for k, e in est.items():
        v = np.mean(e**2)                                    # centro conocido 0: ECM = varianza
        ee = np.sqrt((np.mean(e**4) / v**2 - 1) / R)         # error Monte Carlo relativo
        print(f"   {k:>10}: varianza {v:.5f}  eficiencia {cota / v:.3f} ± {cota / v * ee:.3f}")

Read the table with Monte Carlo errors visible. Under normality mean and MLE are the same, efficiency 11 up to noise. A value slightly above 11 does not violate the bound: it is Monte Carlo error (at most a couple of errors), because the bound is exact and simulation an estimate. Under Laplace, mean efficiency is ≈0.5\approx 0.5, trimmed 0.750.75, and median (MLE) 0.82±0.020.82 \pm 0.02: at n=50n = 50 it has not reached asymptotic limit 11. Under logistic, mean gives 0.880.88, trimmed 0.950.95, median 0.750.75; MLE, the only one using all score information, gives 0.97±0.020.97 \pm 0.02, compatible with 11 (at n=50n = 50 asymptotic convergence still shows). Thus MLE is the default recommendation when the family is known.

With libraries

In practice compute Hessians symbolically (compile with lambdify) when the model is manageable, or with automatic differentiation (jax.hessian, torch.autograd.functional.hessian) otherwise. With sympy derive observed information for gamma, compare it to expected information and simulated standard deviation of shape and scale MLEs, obtained by vectorized Newton on likelihood equation log⁡k−ψ(k)=log⁡xˉ−log⁡x‾\log k - \psi(k) = \log\bar x - \overline{\log x}. Standard errors are [J−1]jj\sqrt{[\mat{J}\inv]_{jj}}.

[ ]Gamma MLE standard errors: symbolic and simulatedBrowser
import numpy as np, sympy as sp
from scipy import stats
from scipy.special import digamma, polygamma

def emv_gamma(x):
    """EMV (forma, escala) por Newton vectorizado; x tiene forma (R, n)."""
    x = np.atleast_2d(x)
    s = np.log(x.mean(1)) - np.log(x).mean(1)
    k = (3 - s + np.sqrt((s - 3) ** 2 + 24 * s)) / (12 * s)          # arranque de Minka
    for _ in range(8):
        k = k - (np.log(k) - digamma(k) - s) / (1 / k - polygamma(1, k))
    return k, x.mean(1) / k

k0, t0, n = 3.0, 2.0, 200
x = np.random.default_rng(3).gamma(k0, t0, size=n)
kh, th = (float(v[0]) for v in emv_gamma(x))
print(f"EMV propio: ({kh:.4f}, {th:.4f})   scipy: ({stats.gamma.fit(x, floc=0)[0]:.4f}, {stats.gamma.fit(x, floc=0)[2]:.4f})")

k, t, xs = sp.symbols("k theta x", positive=True)
logf = -sp.loggamma(k) - k * sp.log(t) + (k - 1) * sp.log(xs) - xs / t
Hs = sp.hessian(logf, (k, t))
fun = [[sp.lambdify((k, t, xs), Hs[i, j], modules=[{"polygamma": polygamma}, "numpy"]) for j in range(2)] for i in range(2)]
Jobs = -np.array([[np.sum(np.broadcast_to(fun[i][j](kh, th, x), x.shape)) for j in range(2)] for i in range(2)])
Jesp = n * np.array([[polygamma(1, kh), 1 / th], [1 / th, kh / th**2]])
se = lambda J: np.sqrt(np.diag(np.linalg.inv(J)))

K, T = emv_gamma(np.random.default_rng(4).gamma(k0, t0, size=(2000, n)))
Jv = n * np.array([[polygamma(1, k0), 1 / t0], [1 / t0, k0 / t0**2]])
print("EE (forma, escala) con J observada simbólica:", np.round(se(Jobs), 4))
print("EE con la esperada n I(theta_hat)           :", np.round(se(Jesp), 4))
print("EE teórica con n I(theta verdadero)         :", np.round(se(Jv), 4))
print("EE simulada (2000 muestras)                 :", np.round([K.std(ddof=1), T.std(ddof=1)], 4))
print(f"correlación teórica {np.linalg.inv(Jv)[0, 1] / np.sqrt(np.prod(np.diag(np.linalg.inv(Jv)))):+.3f}; simulada {np.corrcoef(K, T)[0, 1]:+.3f}")

Three comments. First, our MLE agrees with scipy.stats.gamma.fit to several digits. Second, observed and expected information both evaluated at θ^\hat\theta agree exactly here (gamma Hessian in (k,θ)(k, \theta) is linear in xˉ\bar x and at MLE xˉ=kθ\bar x = k\theta), unlike Cauchy; difference from theoretical SE is only that between θ^\hat\theta and θ\theta. Third, these SEs reproduce simulated MLE spread, and correlation between k^\hat k and θ^\hat\theta is strongly negative (theoretical −0.92-0.92): matrix nondiagonality seen from data.

Common mistakes

Exercises

ProofScore mean zero and variance
Prove: In a regular model, score s(θ;X)=∂θlog⁡f(X;θ)s(\theta;X) = \partial_\theta\log f(X;\theta) satisfies Eθ[s]=0\E_\theta[s] = 0 and Var⁡θ(s)=−Eθ[∂θ2log⁡f(X;θ)]\Var_\theta(s) = -\E_\theta[\partial^2_\theta\log f(X;\theta)].
0
Assume fixed support and that one and two derivatives can pass under the integral.

Step 1 of 4. Which starting identity gives both equalities?

ProofCramér–Rao bound by Cauchy-Schwarz
Prove: Let TT estimate g(θ)g(\theta) with Eθ[T]=g(θ)\E_\theta[T] = g(\theta) and finite variance in a regular model with sample size nn. Then Var⁡θ(T)≥g′(θ)2/(nI(θ))\Var_\theta(T) \ge g'(\theta)^2/(nI(\theta)).
0
Let Sn=∑is(θ;Xi)S_n = \sum_i s(\theta; X_i) be sample score; you know E[Sn]=0\E[S_n] = 0 and Var⁡(Sn)=nI(θ)\Var(S_n) = nI(\theta).

Step 1 of 4. What quantity should be related to g′(θ)g'(\theta)?

NumericCramér–Rao bound for Poisson
For X1,…,Xn∼iidPois⁡(λ)X_1, \dots, X_n \iid \Pois(\lambda) with n=50n = 50 and λ=4\lambda = 4, calculate the Cramér–Rao bound for variance of any unbiased estimator of λ\lambda.
NumericBernoulli information
Calculate Fisher information of one Bern⁡(p)\Bern(p) observation with p=0.2p = 0.2.
NumericJacobian rule in logit
In Bernoulli parameterization φ=log⁡(p/(1−p))\varphi = \log\big(p/(1-p)\big), calculate Fisher information of one observation when p=0.2p = 0.2.
NumericBound for standard deviation
With X1,…,Xn∼iidN(μ,σ2)X_1, \dots, X_n \iid \Normal(\mu, \sigma^2), known μ\mu, n=100n = 100, and σ=2\sigma = 2, calculate the Cramér–Rao bound for variance of an unbiased estimator of σ\sigma.
CodeGamma Fisher information and orthogonal reparameterization
Implement info_gamma(), returning tuple (k, th, mu, I, Iorto): sympy symbols k (shape), th (scale), and mu (mean μ=kθ\mu = k\theta), the Fisher information matrix I of one Gamma⁡(k,θ)\operatorname{Gamma}(k, \theta) observation in parameters (k,θ)(k, \theta), and matrix Iorto in parameters (k,μ)(k, \mu). Method hints: −∇2log⁡f-\hess\log f is affine in xx, so its expectation follows by substituting xx by E[X]=kθ\E[X] = k\theta; for Iorto apply the Jacobian rule with θ=μ/k\theta = \mu/k. Tests check I is not diagonal, Iorto is diagonal, and numerical values.
import sympy as sp

def info_gamma():
  k, th, mu, x = sp.symbols('k theta mu x', positive=True)
  # log f = -loggamma(k) - k log(th) + (k - 1) log(x) - x / th
  # tu código: hessiano, sustituir x por k*th, regla del jacobiano para (k, mu)
  I = sp.eye(2)
  Iorto = sp.eye(2)
  return k, th, mu, I, Iorto
Shift+Enter to run
QuizAn unbiased estimator below the bound
Let X1,…,Xn∼iidUnif⁡(0,θ)X_1, \dots, X_n \iid \Unif(0, \theta). Applying 1/(nI)1/(nI) with I=E[s2]I = \E[s^2] gives θ2/n\theta^2/n, yet n+1nX(n)\frac{n+1}{n}X_{(n)} is unbiased with variance θ2/(n(n+2))<θ2/n\theta^2/(n(n+2)) < \theta^2/n. Which claims are true?

More than one answer may be correct.

QuizObserved and expected information for Cauchy
With n=20n = 20 Cauchy observations of location θ\theta and scale 11, obtain MLE θ^\hat\theta and evaluate Jn(θ^)=−ℓn′′(θ^)J_n(\hat\theta) = -\ell_n''(\hat\theta). Given I(θ)=1/2I(\theta) = 1/2, which claims are true?

More than one answer may be correct.

Summary

Key idea
Fisher information is score variance or equivalently expected log-likelihood curvature, measuring what one observation learns about a parameter. Cramér–Rao says unbiased variance cannot fall below 1/(nI)1/(nI), reached only in exponential families; outside regular models it does not apply.
  • Regularity: fixed support, differentiability, and exchange of derivative and integral. Under these, score has zero mean and variance I(θ)=−E[∂θ2log⁡f]I(\theta) = -\E[\partial^2_\theta\log f] (proved by differentiating ∫f=1\int f = 1 twice).
  • Observed information Jn(θ^)=−ℓn′′(θ^)J_n(\hat\theta) = -\ell_n''(\hat\theta) versus expected nI(θ)nI(\theta): the former is random and measures this sample’s precision (Cauchy, n=20n = 20: JJ ranges from ≈1.7\approx 1.7 to ≈23\approx 23 with nI=10nI = 10); the latter describes the model.
  • Additivity: In=nII_n = nI. Jacobian rule: Iφ=Iθ h′(φ)2I_\varphi = I_\theta\,h'(\varphi)^2 scalar, Iφ=H⊤IθH\mat{I}_\varphi = \mat{H}\T\mat{I}_\theta\mat{H} matrix. Bernoulli: 1/(p(1−p))1/(p(1-p)) for pp, p(1−p)p(1-p) for logit, 44 for arcsin⁡p\arcsin\sqrt p.
  • Information matrix: score-vector covariance, positive semidefinite and positive definite if no nonidentifiable directions. Normal (μ,σ)(\mu, \sigma) gives diag⁡(1/σ2,2/σ2)\operatorname{diag}(1/\sigma^2, 2/\sigma^2) (orthogonal parameters); gamma (k,θ)(k, \theta) is not diagonal, but is in (k,μ)(k, \mu).
  • Cramér–Rao: Var⁡(T)≥g′(θ)2/(nI)\Var(T) \ge g'(\theta)^2/(nI) by Cauchy-Schwarz and Cov⁡(T,Sn)=g′(θ)\Cov(T, S_n) = g'(\theta); with known bias, (1+b′)2/(nI)(1 + b')^2/(nI); in matrix form, Cov⁡(T)⪰DI−1D⊤/n\Cov(\vb{T}) \succeq \mat{D}\mat{I}\inv\mat{D}\T/n by Schur complement.
  • Efficiency: equality requires Sn∝T−g(θ)S_n \propto T - g(\theta), an exponential family. S2S^2 is optimal unbiased but efficiency (n−1)/n(n-1)/n. MLE is asymptotically efficient; at finite nn, Laplace MLE (median) and logistic MLE do not yet attain it (efficiency <1< 1).
  • Nonregular-model failure: for Unif⁡(0,θ)\Unif(0, \theta), E[s]=−1/θ\E[s] = -1/\theta and Var⁡(s)=0\Var(s) = 0; unbiased corrected maximum has variance θ2/(n(n+2))\theta^2/(n(n+2)), below θ2/n\theta^2/n.
  • Geometry: KL⁡(fθ∥fθ+δ)=12δ⊤Iδ+o(∥δ∥2)\KL(f_\theta\|f_{\theta+\delta}) = \frac12\delta\T\mat{I}\delta + o(\norm{\delta}^2). This yields natural gradient (m06), Fisher scoring (GLM), EWC weighting (m20), and Laplace approximation (m14).