Unit 2, lesson 12

Statistical estimation and likelihood

How a likelihood function leads to a maximum likelihood estimator, what consistency, the law of large numbers and the central limit theorem require, and how standard errors and confidence intervals follow.

  • Video 12
  • Estimation and regression

A strategy has four years of monthly returns, and their average is the obvious guess for its expected monthly return. How good is that guess, and how far from the true value might it be? The answer depends on a model of how the returns were generated, and on which properties of that model are actually used. This lesson derives the estimator from a likelihood, shows with the law of large numbers that it settles at the right value as data accumulate, and uses the central limit theorem and exact normal results to attach a standard error and a confidence interval, keeping track of which statements are exact and which are limits.

Key terms

Likelihood function

Definition A statistical model for data x=(x1,…,xn)x = (x_1, \dots, x_n) is a family of joint densities or probability mass functions fθf_\theta, indexed by a parameter θ\theta in a parameter set Θ\Theta. The likelihood function is θ↦L(θ;x)=fθ(x)\theta \mapsto L(\theta; x) = f_\theta(x), the joint density at the observed data, read as a function of θ\theta with xx held fixed. When the model makes the observations independent with a common density fθf_\theta, the joint density factors and

L(θ;x)=∏j=1nfθ(xj).L(\theta; x) = \prod_{j=1}^{n} f_\theta(x_j).

On the set of θ\theta with L(θ;x)>0L(\theta; x) > 0, the log-likelihood is

ℓ(θ;x)=∑j=1nlog⁡fθ(xj),\ell(\theta; x) = \sum_{j=1}^{n} \log f_\theta(x_j),

and because the logarithm is strictly increasing, ℓ\ell and LL are largest at the same parameter values. Independence is what produces the product. For dependent observations, such as a time series, the joint density factors instead into conditional densities,

L(θ;x)=fθ(x1)×∏j=2nfθ(xj∣x1:j−1),\begin{aligned} L(\theta; x) &= f_\theta(x_1) \\[0.4em] &\quad \times \prod_{j=2}^{n} f_\theta(x_j \mid x_{1:j-1}), \end{aligned}

where x1:j−1=(x1,…,xj−1)x_{1:j-1} = (x_1, \dots, x_{j-1}). The likelihood is not a probability distribution over θ\theta. Its integral over Θ\Theta need not be 11 or even finite, and it becomes a posterior density only after it is multiplied by a prior and normalized.

In plain words The data are already in hand and stay fixed. For each candidate parameter, the likelihood measures how much density the model would have put on exactly these observations, so comparing two parameter values means comparing two numbers computed from the same data.

Example Four constructed returns 11, 22, 33 and 44, in percent, are modeled as independent draws from N(μ,4)N(\mu, 4), a normal law with unknown mean μ\mu and known standard deviation 22. Adding and subtracting the sample mean 2.52.5 inside each square gives ∑j(xj−μ)2=5+4(2.5−μ)2\sum_j (x_j - \mu)^2 = 5 + 4(2.5 - \mu)^2, so

ℓ(μ;x)=−2log⁡(8π)−18(5+4(2.5−μ)2).\begin{aligned} \ell(\mu; x) &= -2\log(8\pi) \\[0.4em] &\quad - \tfrac{1}{8}\bigl(5 + 4(2.5 - \mu)^2\bigr). \end{aligned}

The difference ℓ(2.5;x)−ℓ(2;x)=18=0.125\ell(2.5; x) - \ell(2; x) = \tfrac18 = 0.125 says that the likelihood at μ=2.5\mu = 2.5 is e0.125≈1.133e^{0.125} \approx 1.133 times the likelihood at μ=2\mu = 2. The integral of L(μ;x)L(\mu; x) over all real μ\mu is about 0.002120.00212, not 11, which confirms that LL is not a density for μ\mu.

Maximum likelihood estimator

Definition A maximum likelihood estimate for data xx is a value θ^(x)∈Θ\hat\theta(x) \in \Theta with

L(θ^(x);x)=sup⁡θ∈ΘL(θ;x).L(\hat\theta(x); x) = \sup_{\theta \in \Theta} L(\theta; x).

The maximum likelihood estimator is the rule x↦θ^(x)x \mapsto \hat\theta(x), and applied to the random sample it gives a random variable θ^(X)\hat\theta(X). A maximizer need not exist and need not be unique, so each model needs its own argument. For independent observations from N(μ,σ2)N(\mu, \sigma^2) with σ2>0\sigma^2 > 0 known and μ∈R\mu \in \mathbb{R}, the log-likelihood and its derivative are

ℓ(μ;x)=−n2log⁡(2πσ2)−12σ2∑j=1n(xj−μ)2,∂ℓ∂μ=1σ2∑j=1n(xj−μ).\begin{aligned} \ell(\mu; x) &= -\tfrac{n}{2}\log(2\pi\sigma^2) \\[0.4em] &\quad - \frac{1}{2\sigma^2}\sum_{j=1}^{n}(x_j - \mu)^2, \\[0.4em] \frac{\partial \ell}{\partial \mu} &= \frac{1}{\sigma^2}\sum_{j=1}^{n}(x_j - \mu). \end{aligned}

The derivative is zero only where ∑jxj−nμ=0\sum_j x_j - n\mu = 0, that is, at μ=xˉ\mu = \bar x. The second derivative is −n/σ2<0-n/\sigma^2 < 0 for every μ\mu, so ℓ\ell is strictly concave and xˉ\bar x is its unique global maximizer. The estimator is μ^=Xˉ\hat\mu = \bar X. If σ2\sigma^2 is unknown as well, with parameter set R×(0,∞)\mathbb{R} \times (0, \infty), the likelihood is maximized at μ=xˉ\mu = \bar x and

σ2=σ^2=1n∑j=1n(xj−xˉ)2,\sigma^2 = \hat\sigma^2 = \frac{1}{n}\sum_{j=1}^{n}(x_j - \bar x)^2,

provided this average squared residual is positive. If all observations are equal, the likelihood grows without bound as σ2→0\sigma^2 \to 0 and no maximizer exists. Because E[∑j(Xj−Xˉ)2]=(n−1)σ2\mathbb{E}\bigl[\sum_j (X_j - \bar X)^2\bigr] = (n - 1)\sigma^2, the estimator σ^2\hat\sigma^2 has mean (n−1)σ2/n(n - 1)\sigma^2/n, while the sample variance s2s^2, with divisor n−1n - 1 and defined for n≥2n \ge 2, is unbiased.

In plain words Choose the parameter under which the observed data would have been most likely. For a normal mean with known variance that is the sample average. Maximum likelihood and unbiasedness are different criteria, which is why the variance has two common estimators with different divisors.

Example For the returns 11, 22, 33 and 44, the estimate of the mean is μ^=2.5\hat\mu = 2.5, whatever the known value of σ\sigma. The residuals −1.5-1.5, −0.5-0.5, 0.50.5 and 1.51.5 have squared sum 55. Dividing by 44 gives the maximum likelihood variance estimate σ^2=1.25\hat\sigma^2 = 1.25, and dividing by 33 gives the unbiased estimate s2=5/3≈1.667s^2 = 5/3 \approx 1.667, both in percent squared.

Consistency

Definition Let θ^n\hat\theta_n be an estimator computed from the first nn observations of a specified sampling scheme. The sequence (θ^n)(\hat\theta_n) is consistent for θ\theta if, for every θ∈Θ\theta \in \Theta and every ε>0\varepsilon > 0,

lim⁡n→∞Pθ(∣θ^n−θ∣>ε)=0,\lim_{n \to \infty} \mathbb{P}_\theta\bigl(\lvert \hat\theta_n - \theta \rvert > \varepsilon\bigr) = 0,

which means that θ^n\hat\theta_n converges to θ\theta in probability. For independent observations with common mean μ\mu and common finite variance σ2\sigma^2, the sample mean has E[Xˉn]=μ\mathbb{E}[\bar X_n] = \mu and Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar X_n) = \sigma^2/n, and Chebyshev’s inequality gives

P(∣Xˉn−μ∣>ε)≤σ2nε2.\mathbb{P}\bigl(\lvert \bar X_n - \mu \rvert > \varepsilon\bigr) \le \frac{\sigma^2}{n\varepsilon^2}.

The bound tends to zero, so the sample mean is consistent. Unbiasedness, Eθ[θ^n]=θ\mathbb{E}_\theta[\hat\theta_n] = \theta at a fixed nn, is a different property. A biased estimator can be consistent, as σ^2\hat\sigma^2 is in the normal model, and an unbiased estimator can fail to be consistent. Without independence the variance of the mean is

Var⁡(Xˉn)=1n2∑i=1n∑j=1nCov⁡(Xi,Xj),\begin{aligned} &\operatorname{Var}(\bar X_n) \\[0.4em] &\quad = \frac{1}{n^2}\sum_{i=1}^{n}\sum_{j=1}^{n}\operatorname{Cov}(X_i, X_j), \end{aligned}

so the covariance terms decide whether it shrinks at all.

In plain words Consistency is a promise about a sequence of ever larger samples drawn from the model. It does not say that the error in one dataset of a given size is small, and it holds only for the sampling scheme it was proved for.

Example Take σ=2\sigma = 2 and ε=0.5\varepsilon = 0.5, so the Chebyshev bound is 16/n16/n. It is 44 for n=4n = 4, which says nothing, 0.160.16 for n=100n = 100 and 0.010.01 for n=1600n = 1600. Under a normal model the actual probability at n=100n = 100 is about 0.01240.0124, so the bound is valid but conservative. Now suppose a dataset of nn entries consists of copies of one observation X1X_1 with mean μ\mu and variance 44. Its average equals X1X_1 for every nn, so it is unbiased, but its variance stays 44 instead of 4/n4/n. Under a normal model P(∣Xˉn−μ∣>0.5)≈0.803\mathbb{P}(\lvert \bar X_n - \mu \rvert > 0.5) \approx 0.803 for every nn, and the average is not consistent.

Law of large numbers

Definition The weak law of large numbers states that if X1,X2,…X_1, X_2, \dots are independent and identically distributed with E∣X1∣<∞\mathbb{E}\lvert X_1 \rvert < \infty and μ=E[X1]\mu = \mathbb{E}[X_1], then Xˉn→μ\bar X_n \to \mu in probability. Finite variance is not needed. A proof outline truncates the observations. For a level M>0M > 0 put Yj=Xj1{∣Xj∣≤M}Y_j = X_j \mathbf{1}_{\{\lvert X_j \rvert \le M\}} and δM=E[∣X1∣1{∣X1∣>M}]\delta_M = \mathbb{E}\bigl[\lvert X_1 \rvert \mathbf{1}_{\{\lvert X_1 \rvert > M\}}\bigr], which tends to 00 as M→∞M \to \infty because X1X_1 is integrable. Then

Xˉn−μ=(Xˉn−Yˉn)+(Yˉn−E[Y1])+(E[Y1]−μ).\begin{aligned} \bar X_n - \mu &= (\bar X_n - \bar Y_n) \\[0.4em] &\quad + (\bar Y_n - \mathbb{E}[Y_1]) \\[0.4em] &\quad + (\mathbb{E}[Y_1] - \mu). \end{aligned}

Markov’s inequality gives P(∣Xˉn−Yˉn∣>ε)≤δM/ε\mathbb{P}(\lvert \bar X_n - \bar Y_n \rvert > \varepsilon) \le \delta_M/\varepsilon for every nn. The truncated variables are bounded by MM, so Chebyshev’s inequality gives P(∣Yˉn−E[Y1]∣>ε)≤M2/(nε2)\mathbb{P}(\lvert \bar Y_n - \mathbb{E}[Y_1] \rvert > \varepsilon) \le M^2/(n\varepsilon^2). The last term satisfies ∣E[Y1]−μ∣≤δM\lvert \mathbb{E}[Y_1] - \mu \rvert \le \delta_M. When δM≤ε\delta_M \le \varepsilon, these combine to

P(∣Xˉn−μ∣>3ε)≤δMε+M2nε2.\begin{aligned} &\mathbb{P}\bigl(\lvert \bar X_n - \mu \rvert > 3\varepsilon\bigr) \\[0.4em] &\quad \le \frac{\delta_M}{\varepsilon} + \frac{M^2}{n\varepsilon^2}. \end{aligned}

Given η>0\eta > 0, first choose MM with δM≤min⁡(ε,ηε)\delta_M \le \min(\varepsilon, \eta\varepsilon), and then every n≥M2/(ηε2)n \ge M^2/(\eta\varepsilon^2) makes the probability at most 2η2\eta. Since ε\varepsilon and η\eta are arbitrary, this proves the law. The order matters, since the truncation level is fixed before the sample grows. The strong law, which says that Xˉn→μ\bar X_n \to \mu with probability 11, holds under the same hypotheses and is stated here without proof.

In plain words Averages of independent draws from one integrable distribution settle at the population mean. The variance argument is only the easiest case. The law says where the average goes, not how fast it gets there or how large the remaining error is.

Example A return model with a Student t law with 1.51.5 degrees of freedom, shifted to have center μ\mu, has a finite mean μ\mu and infinite variance. For independent draws from it, the Chebyshev bound is unavailable, but the weak law still gives Xˉn→μ\bar X_n \to \mu in probability. The standard Cauchy law, the t law with 11 degree of freedom, has E∣X1∣=∞\mathbb{E}\lvert X_1 \rvert = \infty, and the average of nn independent standard Cauchy draws is again standard Cauchy for every nn. So P(∣Xˉn∣>1)=12\mathbb{P}(\lvert \bar X_n \rvert > 1) = \tfrac12 for every nn, and the average never settles.

Central limit theorem

Definition The central limit theorem states that if X1,X2,…X_1, X_2, \dots are independent and identically distributed with mean μ\mu and variance σ2\sigma^2, where 0<σ2<∞0 < \sigma^2 < \infty, then

n (Xˉn−μ)σ→dN(0,1),\frac{\sqrt{n}\,(\bar X_n - \mu)}{\sigma} \xrightarrow{d} N(0, 1),

that is, the probability that the left side is at most zz tends to Φ(z)\Phi(z) for every real zz. A proof outline uses characteristic functions. The standardized observation Z=(X1−μ)/σZ = (X_1 - \mu)/\sigma has mean 00 and variance 11, and its characteristic function ψZ(u)=E[eiuZ]\psi_Z(u) = \mathbb{E}[e^{iuZ}] satisfies

ψZ(u)=1−u22+o(u2)\psi_Z(u) = 1 - \tfrac{u^2}{2} + o(u^2)

as u→0u \to 0, which needs only the finite second moment. By independence the standardized sum n−1/2∑jZjn^{-1/2}\sum_j Z_j has characteristic function ψZ(u/n)n\psi_Z(u/\sqrt{n})^{n}, and for every real uu

ψZ(u/n)n→e−u2/2,\psi_Z\bigl(u/\sqrt{n}\bigr)^{n} \to e^{-u^2/2},

the characteristic function of N(0,1)N(0, 1). Lévy’s continuity theorem, stated here without proof, says that pointwise convergence of characteristic functions to the characteristic function of a distribution implies convergence in distribution. No moment generating function is required. With infinite variance the theorem does not apply, and other scalings and limits can occur. With a finite third absolute moment ρ=E∣X1−μ∣3\rho = \mathbb{E}\lvert X_1 - \mu \rvert^3, the Berry-Esseen theorem bounds the error of the normal approximation at every zz by Cρ/(σ3n)C\rho/(\sigma^3\sqrt{n}), with an absolute constant CC below 0.50.5, so the quality of the approximation still depends on the size of ρ\rho.

In plain words The law of large numbers says the average settles. The central limit theorem describes the remaining error, which, magnified by n\sqrt{n}, is approximately normal for large nn. It is a statement about the normalized average. Individual observations keep their own distribution, and a short sample does not become normal.

Example A constructed loan book has 100100 loans that default independently, each with probability 0.020.02. The number of defaults has mean 22 and standard deviation 100⋅0.02⋅0.98=1.4\sqrt{100 \cdot 0.02 \cdot 0.98} = 1.4. The exact binomial probability of at least 55 defaults is about 0.05080.0508, while the normal approximation

1−Φ(5−21.4)=1−Φ(2.143)≈0.0161\begin{aligned} 1 - \Phi\Bigl(\frac{5 - 2}{1.4}\Bigr) &= 1 - \Phi(2.143) \\[0.4em] &\approx 0.0161 \end{aligned}

is less than a third of it. The theorem is a limit, and for a skewed count with a small mean, a sample of 100100 is far from that limit in the tail.

Standard error and confidence interval

Definition The standard error of an estimator θ^\hat\theta is the standard deviation of its sampling distribution, SE⁡(θ^)=Var⁡θ(θ^)\operatorname{SE}(\hat\theta) = \sqrt{\operatorname{Var}_\theta(\hat\theta)}. For the mean of nn independent observations with variance σ2\sigma^2 it is SE⁡(Xˉn)=σ/n\operatorname{SE}(\bar X_n) = \sigma/\sqrt{n}, and the estimate SE⁡^=s/n\widehat{\operatorname{SE}} = s/\sqrt{n} replaces σ\sigma by the sample standard deviation. A confidence interval at level 1−α1 - \alpha is a pair of statistics A(X)≤B(X)A(X) \le B(X) with Pθ(A(X)≤θ≤B(X))=1−α\mathbb{P}_\theta\bigl(A(X) \le \theta \le B(X)\bigr) = 1 - \alpha, or at least 1−α1 - \alpha, for every θ∈Θ\theta \in \Theta. For independent N(μ,σ2)N(\mu, \sigma^2) observations with σ\sigma known, n(Xˉn−μ)/σ\sqrt{n}(\bar X_n - \mu)/\sigma is exactly standard normal, so the interval

Xˉn±z0.975 σn,z0.975=Φ−1(0.975)≈1.96,\begin{gathered} \bar X_n \pm z_{0.975}\,\frac{\sigma}{\sqrt{n}}, \\[0.4em] z_{0.975} = \Phi^{-1}(0.975) \approx 1.96, \end{gathered}

covers μ\mu with probability exactly 0.950.95. In the same normal model with σ\sigma unknown and n≥2n \ge 2, a standard result states that n(Xˉn−μ)/s\sqrt{n}(\bar X_n - \mu)/s has the Student t distribution with n−1n - 1 degrees of freedom, and the interval Xˉn±tn−1, 0.975 s/n\bar X_n \pm t_{n-1,\,0.975}\, s/\sqrt{n} is exact. Outside the normal model, for independent identically distributed observations with finite positive variance, the interval Xˉn±z0.975 s/n\bar X_n \pm z_{0.975}\, s/\sqrt{n} has coverage that tends to 0.950.95 as n→∞n \to \infty, by the central limit theorem combined with consistency of ss, with no guarantee at a fixed nn. The probability statement concerns the random endpoints before the data are seen. Once a sample is observed, the interval is two fixed numbers that either contain the fixed μ\mu or not, and the frequentist calculation assigns no probability 0.950.95 to μ\mu itself.

In plain words The standard error is the typical size of the estimation error across repeated samples. A confidence interval is a procedure that, under its assumptions, captures the true value in a stated fraction of repeated samples. Its guarantee is exact, asymptotic or absent depending on which assumptions hold.

Example For the four returns with known σ=2\sigma = 2, the standard error is 2/4=12/\sqrt{4} = 1, and the exact 9595 percent interval is 2.5±1.962.5 \pm 1.96, about [0.5400,4.4600][0.5400, 4.4600], under the stated normal model. If σ\sigma is unknown, then s=5/3≈1.2910s = \sqrt{5/3} \approx 1.2910 and SE⁡^≈0.6455\widehat{\operatorname{SE}} \approx 0.6455. The quantile t3, 0.975≈3.1824t_{3,\,0.975} \approx 3.1824 gives the exact interval [0.4457,4.5543][0.4457, 4.5543], which is wider. Putting ss into the known-variance formula instead gives [1.2348,3.7652][1.2348, 3.7652], and under the normal model with n=4n = 4 that procedure covers μ\mu with probability only about 0.8550.855.

Check yourself

  1. A model treats 400400 daily returns as independent draws from a normal distribution with known standard deviation 11 percent. Their sample mean is 0.050.05 percent. Find the standard error of the sample mean and a 9595 percent confidence interval for the expected daily return, and say what the 9595 percent refers to.
Show the answer

The standard error is 1/400=0.051/\sqrt{400} = 0.05 percent. The interval is

0.05±1.96⋅0.05=0.05±0.098=[−0.048,0.148]\begin{aligned} 0.05 \pm 1.96 \cdot 0.05 &= 0.05 \pm 0.098 \\[0.4em] &= [-0.048, 0.148] \end{aligned}

in percent. Under the model, the random interval built this way covers the fixed expected return in 9595 percent of repeated samples of 400400 returns. The observed interval either contains it or not, so it is wrong to say that the expected return lies in [−0.048,0.148][-0.048, 0.148] with probability 0.950.95. The interval contains 00, which means the data are compatible with a zero mean at this level, not that the mean is zero.

  1. A file of 500500 daily returns turns out to contain each of 250250 returns twice. The 250250 distinct returns are modeled as independent with known standard deviation 1.21.2 percent. An analyst reports the standard error 1.2/500≈0.05371.2/\sqrt{500} \approx 0.0537 for the mean of the file. What is wrong, and what is the correct standard error?
Show the answer

The mean of the 500500 rows equals the mean of the 250250 distinct returns, because every value appears exactly twice. Its variance is therefore 1.22/2501.2^2/250, and the correct standard error is 1.2/250≈0.07591.2/\sqrt{250} \approx 0.0759, larger by the factor 2\sqrt{2}. The formula σ/n\sigma/\sqrt{n} assumes nn independent observations, and the two copies of a return have correlation 11. In the double sum for Var⁡(Xˉn)\operatorname{Var}(\bar X_n), each pair of identical rows contributes four terms equal to σ2\sigma^2, two variances and two covariances, where two independent rows would contribute only the two variances. With n=500n = 500 this gives

250⋅4σ25002=σ2250.\frac{250 \cdot 4\sigma^2}{500^2} = \frac{\sigma^2}{250}.

An interval xˉ±1.96⋅0.0537\bar x \pm 1.96 \cdot 0.0537 would cover the true mean with probability only 2Φ(1.96/2)−1≈0.8342\Phi(1.96/\sqrt{2}) - 1 \approx 0.834, not 0.950.95. More rows do not add information unless they are new observations.

  1. Times between trades, in seconds, are modeled as independent exponential variables with density λe−λx\lambda e^{-\lambda x} for x≥0x \ge 0 and an unknown rate λ>0\lambda > 0. The observed times are 0.50.5, 1.51.5, 22 and 44. Derive the maximum likelihood estimate, check that it is a maximum, and decide whether the estimator is unbiased and whether it is consistent.
Show the answer

The log-likelihood is ℓ(λ)=nlog⁡λ−λ∑jxj=4log⁡λ−8λ\ell(\lambda) = n\log\lambda - \lambda\sum_j x_j = 4\log\lambda - 8\lambda. Its derivative 4/λ−84/\lambda - 8 is zero only at λ=0.5\lambda = 0.5, and its second derivative −4/λ2-4/\lambda^2 is negative on all of (0,∞)(0, \infty), so ℓ\ell is strictly concave and λ^=0.5\hat\lambda = 0.5 per second is the unique maximizer. In general λ^=n/∑jxj=1/xˉ\hat\lambda = n/\sum_j x_j = 1/\bar x, provided the times are not all zero. The estimator is biased. The sum of n≥2n \ge 2 independent exponential times has a gamma distribution, and a direct integration gives

E[λ^n]=nλn−1,\mathbb{E}[\hat\lambda_n] = \frac{n\lambda}{n - 1},

which is 4λ/34\lambda/3 for n=4n = 4. It is consistent. Since E[X1]=1/λ\mathbb{E}[X_1] = 1/\lambda is finite, the law of large numbers gives Xˉn→1/λ\bar X_n \to 1/\lambda in probability, and because x↦1/xx \mapsto 1/x is continuous at 1/λ>01/\lambda > 0, the continuous mapping theorem gives λ^n→λ\hat\lambda_n \to \lambda in probability. The bias factor n/(n−1)n/(n - 1) tends to 11, another case of a biased but consistent estimator.

How this lesson connects

It also uses characteristic functions and Student t distribution.