Algorithm Search⌘K

Definitioncore

Score function

Also called score vector, gradient of the log-likelihood.

The gradient of the log-likelihood with respect to the parameter. Under regularity it has mean zero, and its variance is the Fisher information.

The score function is the derivative, or for a vector parameter the gradient, of the log-likelihood with respect to the parameter. It tells how fast the log-likelihood changes when the parameter moves. At the true parameter value it is a random variable with mean zero, and its variance is the Fisher information. Setting it to zero gives the likelihood equation of maximum likelihood estimation, and it is the main object behind the Cramér-Rao bound, the score test and Fisher scoring.

Definition

Let X1,…,XnX_1, \ldots, X_n be iid with density or mass function f(x;θ)f(x; \theta), θ∈Θ⊆Rk\theta \in \Theta \subseteq \mathbb R^k, with Θ\Theta open and log⁡f(x;θ)\log f(x; \theta) differentiable in θ\theta for every xx.

Score of one observation.

u(θ;x)=∇θlog⁡f(x;θ)=∇θf(x;θ)f(x;θ),where f(x;θ)>0.u(\theta; x) = \nabla_\theta \log f(x; \theta) = \frac{\nabla_\theta f(x; \theta)}{f(x; \theta)}, \qquad \text{where } f(x; \theta) > 0.

For k=1k = 1 this is ∂θlog⁡f(x;θ)\partial_\theta \log f(x; \theta).

Score of the sample. With ℓ(θ;x)=∑ilog⁡f(xi;θ)\ell(\theta; x) = \sum_i \log f(x_i; \theta),

Un(θ)=∇θ ℓ(θ;X)=∑i=1nu(θ;Xi).U_n(\theta) = \nabla_\theta\, \ell(\theta; X) = \sum_{i=1}^n u(\theta; X_i).

For a fixed θ\theta, Un(θ)U_n(\theta) is a random vector, a function of the data. For fixed data, θ↦Un(θ)\theta \mapsto U_n(\theta) is a function of the parameter. Both readings are used, and the context says which.

Fisher information. I(θ)=Var⁡θ u(θ;X1)I(\theta) = \operatorname{Var}_\theta\, u(\theta; X_1) is the information of one observation, a k×kk \times k matrix for vector θ\theta, and In(θ)=nI(θ)=Var⁡θ Un(θ)I_n(\theta) = n I(\theta) = \operatorname{Var}_\theta\, U_n(\theta) is the information of the sample.

Observed information. Jn(θ)=−∇θ2 ℓ(θ;X)J_n(\theta) = -\nabla_\theta^2\, \ell(\theta; X), minus the Jacobian of the score. It is a random matrix, and under the conditions below EθJn(θ)=In(θ)\mathbb{E}_\theta J_n(\theta) = I_n(\theta).

Properties

The properties below hold under the regularity conditions on the Cramér-Rao bound page: the support {x:f(x;θ)>0}\{x : f(x; \theta) > 0\} does not depend on θ\theta, and ∫f(x;θ) dx\int f(x; \theta)\, dx can be differentiated under the integral sign (once for (a), twice for (c)).

(a) Mean zero. Eθ u(θ;X)=0\mathbb{E}_\theta\, u(\theta; X) = 0.

Proof. Eθ u=∫∇θff f dx=∇θ∫f(x;θ) dx=∇θ1=0\mathbb{E}_\theta\, u = \int \frac{\nabla_\theta f}{f}\, f\, dx = \nabla_\theta \int f(x; \theta)\, dx = \nabla_\theta 1 = 0. □\square

The mean is zero only when the score and the distribution use the same θ\theta. For θ′≠θ\theta' \ne \theta, Eθ u(θ′;X)\mathbb{E}_\theta\, u(\theta'; X) is in general not zero; this is why the score detects a wrong parameter value.

(b) Variance is the information. By (a), I(θ)=Eθ[u u⊤]I(\theta) = \mathbb{E}_\theta[u\, u^\top], and for the sample Var⁡θUn(θ)=nI(θ)\operatorname{Var}_\theta U_n(\theta) = n I(\theta), because the terms are iid with mean zero.

(c) Information identity. I(θ)=−Eθ ∇θ2log⁡f(X;θ)I(\theta) = -\mathbb{E}_\theta\, \nabla_\theta^2 \log f(X; \theta). Differentiate ∫u f dx=0\int u\, f\, dx = 0 once more, and use ∇θf=uf\nabla_\theta f = u f. The Fisher information matrix page gives the details.

(d) Covariance with an estimator. If T(X)T(X) has EθT=ψ(θ)\mathbb{E}_\theta T = \psi(\theta) and ∫Tf dx\int T f\, dx can be differentiated under the integral, then Cov⁡θ(T,Un(θ))=∇θψ(θ)\operatorname{Cov}_\theta(T, U_n(\theta)) = \nabla_\theta \psi(\theta). With the Cauchy-Schwarz inequality this gives the Cramér-Rao bound.

(e) It depends on the data only through a sufficient statistic. If f(x;θ)=g(t(x);θ) h(x)f(x; \theta) = g(t(x); \theta)\, h(x) (factorization theorem), then Un(θ)=∇θlog⁡g(t(X);θ)U_n(\theta) = \nabla_\theta \log g(t(X); \theta), a function of t(X)t(X).

(f) Change of parameter. If θ=θ(η)\theta = \theta(\eta) with Jacobian D=∂θ/∂ηD = \partial\theta/\partial\eta, the score in η\eta is D⊤u(θ;x)D^\top u(\theta; x), and the information becomes D⊤I(θ)DD^\top I(\theta) D.

(g) Large samples. By the central limit theorem, Un(θ)/nU_n(\theta)/\sqrt n converges in distribution to N(0,I(θ))N(0, I(\theta)) under θ\theta. This is the step behind the asymptotic normality of the MLE and the null distribution of the score test. Under θ\theta, the sequence U1(θ),U2(θ),…U_1(\theta), U_2(\theta), \ldots is a sum of iid mean-zero terms, so it is a martingale in nn.

(h) Likelihood equation. An interior maximum θ^\hat\theta of the likelihood solves Un(θ^)=0U_n(\hat\theta) = 0. Newton's method on this equation uses JnJ_n; Fisher scoring replaces JnJ_n by InI_n.

Examples and non-examples

Bernoulli. u(p;x)=xp−1−x1−p=x−pp(1−p)u(p; x) = \frac{x}{p} - \frac{1 - x}{1 - p} = \frac{x - p}{p(1-p)}, so Un(p)=n(Xˉ−p)p(1−p)U_n(p) = \frac{n(\bar X - p)}{p(1-p)} and I(p)=1/(p(1−p))I(p) = 1/(p(1-p)). The score is an affine function of Xˉ\bar X, which is why Xˉ\bar X attains the Cramér-Rao bound.

Poisson, on the sample (3,7,7,9,14)(3, 7, 7, 9, 14). u(λ;x)=x/λ−1u(\lambda; x) = x/\lambda - 1, so U5(λ)=40/λ−5U_5(\lambda) = 40/\lambda - 5 with ∑ixi=40\sum_i x_i = 40.

λ\lambda U5(λ)U_5(\lambda) observed J5(λ)=40/λ2J_5(\lambda) = 40/\lambda^2 expected I5(λ)=5/λI_5(\lambda) = 5/\lambda
55 33 8/58/5 11
88 00 5/85/8 5/85/8
1010 −1-1 2/52/5 1/21/2

The score is positive below the maximum likelihood estimate λ^=xˉ=8\hat\lambda = \bar x = 8 and negative above it. At λ^\hat\lambda the observed and expected information agree, which holds for every Poisson sample.

Normal with both parameters. For θ=(μ,σ2)\theta = (\mu, \sigma^2),

u(θ;x)=(x−μσ2, −12σ2+(x−μ)22σ4),I(θ)=(1/σ2001/(2σ4)).u(\theta; x) = \Big(\frac{x - \mu}{\sigma^2},\ -\frac{1}{2\sigma^2} + \frac{(x - \mu)^2}{2\sigma^4}\Big), \qquad I(\theta) = \begin{pmatrix} 1/\sigma^2 & 0 \\ 0 & 1/(2\sigma^4) \end{pmatrix}.

On (3,7,7,9,14)(3, 7, 7, 9, 14), with xˉ=8\bar x = 8 and ∑i(xi−xˉ)2=64\sum_i (x_i - \bar x)^2 = 64: at μ=6\mu = 6, σ2=16\sigma^2 = 16 the μ\mu component is (40−30)/16=5/8(40 - 30)/16 = 5/8; at μ=8\mu = 8, σ2=16\sigma^2 = 16 the σ2\sigma^2 component is −5/32+64/512=−1/32-5/32 + 64/512 = -1/32. The σ2\sigma^2 component is zero at σ2=64/5=12.8\sigma^2 = 64/5 = 12.8, the maximum likelihood estimate with divisor nn, not at S2=16S^2 = 16.

Exponential. For rate β\beta, f(x;β)=βe−βxf(x; \beta) = \beta e^{-\beta x}, so u=1/β−xu = 1/\beta - x and Un(β)=n/β−∑iXiU_n(\beta) = n/\beta - \sum_i X_i.

Exponential families. In natural form h(x)exp⁡(η⊤T(x)−A(η))h(x)\exp(\eta^\top T(x) - A(\eta)), u(η;x)=T(x)−∇A(η)u(\eta; x) = T(x) - \nabla A(\eta): the score is the sufficient statistic minus its mean.

Non-example: a support that moves. For Uniform(0,θ)(0, \theta), log⁡f=−log⁡θ\log f = -\log\theta on the support, so u=−1/θu = -1/\theta for every xx in (0,θ)(0, \theta). Its mean is −1/θ≠0-1/\theta \ne 0. The support depends on θ\theta, the derivative does not pass under the integral, and properties (a) to (d) fail. The likelihood is maximized at max⁡ixi\max_i x_i, where it is not differentiable, and the likelihood equation has no solution.

Non-example: several roots. For the Cauchy location model, u(θ;x)=2(x−θ)1+(x−θ)2u(\theta; x) = \frac{2(x - \theta)}{1 + (x - \theta)^2}. With two observations x=(−a,a)x = (-a, a) and a>1a > 1, U2(θ)=0U_2(\theta) = 0 has the three roots 00 and ±a2−1\pm\sqrt{a^2 - 1}; at a=5a = 5 these are 00 and ±4.899\pm 4.899. The root at 00 is a local minimum of the likelihood. A zero of the score is not always a maximum.

Pitfalls

  • Score in the parameter, not in the data. In machine learning, "score" often means ∇xlog⁡p(x)\nabla_x \log p(x), the gradient with respect to the data point, used in score matching and diffusion models. That is a different object; this page is about ∇θ\nabla_\theta.
  • Sign and scale. Some texts define the score with log⁡L\log L for the full sample, others per observation, and some divide by nn. The mean zero property holds in all of them; the variance scales accordingly.
  • The information identity needs two derivatives under the integral. When only the first exists, E[u2]\mathbb{E}[u^2] is still the information, but −E[∂2log⁡f]-\mathbb{E}[\partial^2 \log f] may differ from it.

References

  1. George Casella and Roger L. Berger, Statistical Inference, second edition, Duxbury, 2002, Section 7.3.2 (the derivative of the log-likelihood in the Cramér-Rao inequality and the information identity) and Section 10.3.2 (other large-sample tests, including the score test)
  2. E. L. Lehmann and George Casella, Theory of Point Estimation, second edition, Springer, 1998, Chapter 2, Section 2.5 (the information inequality) and Chapter 6 (likelihood equations)
  3. R. A. Fisher, Theory of statistical estimation, Mathematical Proceedings of the Cambridge Philosophical Society 22(5), 1925, pages 700 to 725, the amount of information and the derivative of the log-likelihood

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/1WBGCK/text.yaml