Quant Memo
Advanced

The Score Function and Likelihood Equations

The 'slope' of how well a parameter explains your data — and why setting that slope to zero is how maximum likelihood estimation actually finds its answer.

Prerequisites: Maximum Likelihood Estimation (MLE), Standard Deviation

Maximum likelihood estimation says: pick the parameter value that makes your observed data most probable. In practice, "search over every possible parameter value and check which one gives the highest likelihood" is not how it's actually done — that would be painfully slow. Instead, you use calculus: find where the likelihood stops rising and starts falling, which is exactly where its slope is zero. The score function is that slope, and the equation that sets it to zero is how virtually every maximum-likelihood estimate is actually computed.

An analogy: finding the top of a hill blindfolded

You're standing somewhere on a hill, blindfolded, trying to find the summit. You can't see the whole hill, but you can feel the ground's slope under your feet at your current position. If the ground tilts upward ahead of you, you're not at the top yet — move forward. If it tilts downward, you've overshot — step back. The summit is exactly the one spot where the ground feels flat under your feet: zero slope. The score function is that "felt slope," measured not on physical ground but on the log-likelihood surface, as you vary a candidate parameter value.

The definitions, one symbol at a time

Let θ\theta ("theta") be the parameter and L(θ)L(\theta) the likelihood — how probable the observed data is, as a function of θ\theta. Work with the log-likelihood, (θ)=logL(θ)\ell(\theta) = \log L(\theta), because logs turn the products in a likelihood into sums, which are far easier to differentiate. The score function is its derivative:

S(θ)=θ(θ)S(\theta) = \frac{\partial}{\partial \theta}\, \ell(\theta)

Read this as: "the score is the slope of the log-likelihood curve at a given value of θ\theta." In plain English, the score tells you which direction, and how strongly, increasing θ\theta would improve how well your data is explained. A positive score means "push θ\theta up, the fit is still improving"; a negative score means "you've gone too far, pull back."

The maximum likelihood estimate θ^\hat\theta is found by solving the likelihood equation — setting the score to zero:

S(θ^)=0S(\hat\theta) = 0

In plain English: the MLE is the parameter value where the log-likelihood is flat — not still climbing, not falling — which, for a well-behaved single-peaked likelihood, is exactly its summit.

Function explorer
-2222.0
x = 1.00f(x) = 2.000

The explorer above shows a curve and lets you see where its slope is zero — that flat point is the maximum of the curve. The log-likelihood plays the exact same role here: S(θ)S(\theta) is its slope, and θ^\hat\theta is the flat point.

Distribution · binomial
mean 7.0012345678910outcomes (k) →
mean 7.00std dev 1.45peak at k = 7

The binomial explorer above lets you drag pp and watch which value makes the observed count of heads look most probable — that dragging, done by hand, is exactly what solving S(p)=0S(p)=0 does automatically, landing on the pp that peaks the likelihood of what you actually saw.

The score function is the derivative of the log-likelihood with respect to the parameter. Setting it to zero and solving is, for the vast majority of statistical models used in practice, literally how the maximum likelihood estimate gets computed — by hand for simple models, numerically (via Newton-Raphson) for complicated ones.

Worked example 1: the MLE of a coin's bias, from its score function

You flip a coin n=10n=10 times and observe k=7k=7 heads. Model each flip as Bernoulli with unknown heads-probability pp. The log-likelihood of the whole sample is (p)=klogp+(nk)log(1p)=7logp+3log(1p)\ell(p) = k\log p + (n-k)\log(1-p) = 7\log p + 3\log(1-p).

The score function is its derivative with respect to pp:

S(p)=7p31p.S(p) = \frac{7}{p} - \frac{3}{1-p} .

Set it to zero and solve: 7p=31p    7(1p)=3p    77p=3p    7=10p    p=0.7\dfrac{7}{p} = \dfrac{3}{1-p} \implies 7(1-p) = 3p \implies 7 - 7p = 3p \implies 7 = 10p \implies p = 0.7.

The MLE is p^=0.7=k/n\hat p = 0.7 = k/n — exactly the sample proportion, derived here from first principles by finding where the score is zero, not assumed. Check the score at a nearby value, p=0.5p=0.5: S(0.5)=70.530.5=146=8S(0.5) = \frac{7}{0.5} - \frac{3}{0.5} = 14 - 6 = 8, positive — confirming the log-likelihood is still climbing at p=0.5p=0.5 and p^\hat p must be higher, consistent with landing at 0.70.7.

Worked example 2: the score function of a normal mean

You observe n=4n=4 daily returns, in percent: 1.2,0.8,1.5,0.91.2, 0.8, 1.5, 0.9, assumed normal with known standard deviation σ=1\sigma = 1 and unknown mean μ\mu. The log-likelihood (dropping constants that don't involve μ\mu) is (μ)=12i=14(xiμ)2\ell(\mu) = -\frac{1}{2}\sum_{i=1}^{4} (x_i - \mu)^2.

The score function is S(μ)=i=14(xiμ)=(1.2μ)+(0.8μ)+(1.5μ)+(0.9μ)=4.44μS(\mu) = \sum_{i=1}^{4} (x_i - \mu) = (1.2-\mu)+(0.8-\mu)+(1.5-\mu)+(0.9-\mu) = 4.4 - 4\mu.

Set it to zero: 4.44μ=0    μ=1.14.4 - 4\mu = 0 \implies \mu = 1.1.

The MLE is μ^=1.1\hat\mu = 1.1, which is exactly the sample mean 1.2+0.8+1.5+0.94=4.44=1.1\frac{1.2+0.8+1.5+0.9}{4} = \frac{4.4}{4} = 1.1 — again derived by finding the flat point of the score, not asserted. Try μ=1.0\mu = 1.0: S(1.0)=4.44(1.0)=0.4>0S(1.0) = 4.4 - 4(1.0) = 0.4 > 0, meaning the log-likelihood is still rising as μ\mu increases past 1.01.0, correctly pointing toward the true maximum at 1.11.1.

What this means in practice

  • Every "fit this distribution's parameters" routine in a statistics library — fitting a GARCH model, a Poisson jump intensity, a logistic regression — is, under the hood, solving a score equation, usually numerically because a closed-form solution like the two above is rare in realistic models.
  • When numerical optimization fails to converge or gives a suspicious answer, the score function is the diagnostic: plot it (or the log-likelihood directly) against the parameter and check whether it actually crosses zero cleanly, or whether the surface is flat, multi-peaked, or unbounded.
  • The score function also has a mean of exactly zero when evaluated at the true parameter, a property called unbiasedness of the score — this fact is the seed that eventually leads to the Cramér-Rao bound on how precise any unbiased estimator can be.

The classic mistake is assuming that solving S(θ^)=0S(\hat\theta)=0 always finds the maximum. A zero score only marks a flat point — it could be a maximum, a minimum, or a saddle, and for a likelihood with multiple local peaks (common in mixture models or complex nonlinear models), several different θ\theta values can all satisfy S(θ)=0S(\theta)=0. In practice you must check the second derivative is negative (confirming a peak, not a valley) and, for multi-peaked likelihoods, compare the log-likelihood value at each candidate solution to find the true global maximum.

Related concepts

Practice in interviews

Further reading

  • Casella & Berger, Statistical Inference, sec. 7.2, 7.3
  • Lehmann & Casella, Theory of Point Estimation, ch. 2
ShareTwitterLinkedIn