Likelihood ratio tests and Wilks' theorem
The question
Ten waiting times, and a null that fixes their rate at 1 per minute. If the null is true, how is twice the log-likelihood gap spread?
Pick a law, then compare it with 2,000 simulated studies.
- 1 SeePick a law, then run 2,000 studies.
- 2 TryTest small samples and an edge case.
- 3 ProveBuild the one-parameter proof, line by line.
- 4 ApplyCompute W and p-values in five problems.
Before you start · 3 quick checks on a maximum likelihood estimate, sums of squared normals and tail probabilities, about 3 min
Two ideas before you start
2 ideasW measures a drop in log-likelihood
Figure: the log-likelihood of four waiting times as a curve in the rate, a dashed level line at its top, and a dashed vertical drop from the top level to the curve at the null rate. It needs JavaScript.
θ₀ = 2: ℓ(θ̂) ≈ −4.893 ℓ(θ₀) ≈ −7.227 W ≈ 4.670
Four waiting times add up to 5 minutes, so the best rate is θ̂ = 4/5 = 0.8 per minute. W is twice the drop of the log-likelihood from its top to its value at the null rate θ₀. It is never negative.
Exact definition
Models and likelihood. Data \(x_1, \dots, x_n\) are modeled as values of independent random variables with density or probability function \(f(x; \theta)\), where the parameter \(\theta\) lies in a set \(\Theta\), the full model. The log-likelihood is \(\ell(\theta) = \sum_i \ln f(x_i; \theta)\). A null hypothesis \(H_0: \theta \in \Theta_0\) names a smaller set \(\Theta_0 \subset \Theta\), the null model.
The statistic. Let \(\hat\theta\) maximize \(\ell\) over \(\Theta\) and \(\hat\theta_0\) maximize it over \(\Theta_0\). The likelihood ratio is \(\Lambda = L(\hat\theta_0)/L(\hat\theta)\), where \(L = e^{\ell}\) is the likelihood, and the likelihood ratio statistic is
\[\begin{aligned} W &= -2\ln\Lambda \\ &= 2[\ell(\hat\theta) - \ell(\hat\theta_0)]. \end{aligned}\]Since \(\Theta_0 \subset \Theta\), \(\ell(\hat\theta_0) \le \ell(\hat\theta)\), so \(W \ge 0\). A large \(W\) says the null model fits the data much worse than the full model. When \(\Theta_0\) is a single point \(\theta_0\), \(\hat\theta_0 = \theta_0\).
The card. The waiting times 0.4, 1.1, 0.7 and 2.8 minutes are modeled as exponential with rate \(\theta \gt 0\), \(f(x; \theta) = \theta e^{-\theta x}\) for \(x \ge 0\). So \(\ell(\theta) = 4\ln\theta - 5\theta\) and \(\hat\theta = 4/5\). The lesson on maximum likelihood finds maximizers like this one.
Nested models: count what the null fixes
Figure: the half-plane of normal models with mean μ and standard deviation σ above 0, shaded, and the part a null hypothesis keeps, dashed. It needs JavaScript.
H₀: μ = 0: full model 2 free null 1 free fixed by the null r = 1
A null hypothesis keeps part of the full model. A normal model with mean μ and standard deviation σ has 2 free parameters; r counts how many of them the null pins down.
Exact definition
Nested models. The null model is nested in the full model when \(\Theta_0 \subset \Theta\). In the regular cases of this lesson, \(\Theta\) is an open subset of \(\mathbb{R}^k\) (an open interval when \(k = 1\)), and \(\Theta_0\) fixes \(r\) of the \(k\) coordinates, possibly after a smooth change of coordinates, leaving the other \(k - r\) free. So \(r\) is the number of free parameters of the full model minus the number of free parameters of the null model.
The card. For normal models with \((\mu, \sigma)\) in \(\mathbb{R} \times (0, \infty)\), \(k = 2\). \(H_0: \mu = 0\) keeps a line and leaves \(\sigma\) free, so \(r = 1\). \(H_0: \sigma = 1\) also keeps a line, \(r = 1\). \(H_0: \mu = 0, \sigma = 1\) keeps one point, \(r = 2\). A parameter the null leaves free is estimated under both models.
Fine print: names, logs and the chi-square family
\(\ln\) is the natural logarithm. \(W\) is also written \(-2\ln\Lambda\); for counts it is called the \(G\) statistic or a difference of deviances. Some books write the ratio the other way up, \(L(\hat\theta)/L(\hat\theta_0)\); then \(W\) is twice its logarithm.
\(\chi^2_k\), chi-square with \(k\) degrees of freedom, is the law of the sum of the squares of \(k\) independent standard normal variables. Its mean is \(k\). The lesson on chi-square, t and F has its density. Throughout this lesson the observations within a model are independent, and each test is fixed before the data are seen.
Which law does W follow?
- Read the round: the model, what the null fixes, and how many observations each run uses.
- Pick the law you expect W to follow when the null is true. Its share per bin is drawn as a dashed line.
- Press Check my law. The page runs the study 2,000 times with the null true and shows where W fell.
How the runs and the gap work
Each round repeats one study 2,000 times from a fixed random seed, so a revisit shows the same runs. They are one seeded sample, an illustration rather than a measurement: another seed would move every count and share on this stage a little. In every run the null hypothesis is true; the page fits both models by maximum likelihood and records \(W\). The bars show the share of runs with \(W\) in each bin of width 0.5 from 0 to 10, and a tile counts the runs with \(W\) at least 10.
The gap between the runs and a law is half the sum, over the 21 bins (20 of width 0.5 and one for \(W \ge 10\)), of the distance between the share of runs in the bin and the probability the law gives it. It is 0 for a perfect match and at most 1. Even the right law leaves a small gap, because 2,000 runs are a finite sample.
| Round | Model | r | Your pick | Closest law | Share above c |
|---|
Count the parameters. In rounds 1 and 2 the runs sit close to \(\chi^2_r\), where \(r\) is the number of free parameters the null removes: \(r = 1\) for the waiting times and \(r = 3 - 1 = 2\) for the call centers. This is Wilks' theorem, stated and proved for one parameter in stage 3.
Mind the edge. In round 3 the true mean sits on the boundary of the allowed range \(\mu \ge 0\). Then \(W = 0\) whenever \(\bar x \le 0\), which has probability \(\tfrac{1}{2}\), and the law of \(W\) is half a point mass at 0 and half \(\chi^2_1\), for every \(n\), in this normal model with known \(\sigma\). Wilks' theorem needs the true parameter inside the full model, not on its edge.
How good is the chi-square cutoff?
A prediction first. The explorer below it opens once it is answered.
Explorer: the exact chance for n waiting times
Move \(n\). The dashed curve is the exact tail \(P(W \gt w)\) of the waiting-time test under \(H_0\), and the solid curve is the \(\chi^2_1\) tail. Their heights at the dotted line are the two chances of rejecting with the cutoff \(c\).
Goals
For the waiting-time test the exact chance stays above 5% at every \(n\) of the explorer, and the excess shrinks roughly like \(1/n\). More rejections come from small totals than from large ones: at small \(n\) the two sides are far from equal. Wilks' theorem is a statement about the limit; at a given \(n\) it is an approximation whose quality depends on the model.
An edge case
Why the limit is chi-square: one parameter
Assumptions.
- \(X_1, \dots, X_n\) are independent, each with density or probability function \(f(x; \theta)\), where \(\theta\) lies in an open interval \(\Theta\); the log-likelihood is \(\ell(\theta) = \sum_i \ln f(X_i; \theta)\).
- The null is \(H_0: \theta = \theta_0\) for one fixed \(\theta_0\) in \(\Theta\), and it is true.
- \(\ell\) is twice continuously differentiable in \(\theta\), and with probability tending to 1 as \(n\) grows it has a maximizer \(\hat\theta\) in \(\Theta\), an interior point.
- The Fisher information of one observation, \(I(\theta_0)\), is finite and positive.
Facts the proof uses. They follow from the usual regularity conditions on \(f\); this lesson does not prove them.
- (F1) \(\sqrt{n}(\hat\theta - \theta_0) \to N(0, 1/I(\theta_0))\) in distribution.
- (F2) For any random point \(\tilde\theta\) between \(\hat\theta\) and \(\theta_0\), \(-\ell''(\tilde\theta)/n \to I(\theta_0)\) in probability.
- Slutsky and continuous mapping: if \(A_n \to a\) in probability for a constant \(a\) and \(Z_n \to Z\) in distribution, then \(A_nZ_n^2 \to aZ^2\) in distribution.
Conclusion. \(W = 2[\ell(\hat\theta) - \ell(\theta_0)] \to \chi^2_1\) in distribution: for every \(c \gt 0\), \(P(W \gt c) \to P(\chi^2_1 \gt c)\).
Each option is one step. Pick the one that is true for every model that meets the assumptions and every sample with an interior maximizer.
- Several parameters. If the full model has \(k\) free parameters, the null fixes \(r\) of them, the true value is an interior point and the same kind of regularity holds, the expansion in \(k\) dimensions writes \(W\) as a quadratic form that tends to a sum of \(r\) squared independent standard normal variables. So \(W \to \chi^2_r\) in distribution. Rounds 1 and 2 of stage 1 use this version; its proof needs matrices and is not given here.
- An exact case. For a normal mean with known \(\sigma\), \(\ell\) is a quadratic in \(\theta\), \(\ell''\) is the constant \(-n/\sigma^2\), and \(W = n(\bar x - \theta_0)^2/\sigma^2 = Z_n^2\), with \(Z_n\) exactly standard normal under \(H_0\). So \(W\) has the \(\chi^2_1\) law for every \(n\), not only in the limit.
- The edge of round 3. With \(\mu \ge 0\) and \(\theta_0 = 0\), the maximizer is the boundary point 0 whenever \(\bar x \le 0\). There \(\ell'(0) = n\bar x/\sigma^2\) need not be 0, so line 2 fails. Then \(W = 0\), so \(P(W = 0) = \tfrac{1}{2}\), and for \(w \gt 0\), \(P(W \gt w) = \tfrac{1}{2}P(\chi^2_1 \gt w)\), for every \(n\). This half-and-half law is a special case: one parameter, a one-sided range, the null value on its edge. In other models with the true value on an edge, the large-sample law of \(W\) is again a mixture of chi-square laws, but its weights and degrees of freedom depend on how many parameters sit on the edge and on the shape of the parameter set.
- The test. Reject \(H_0\) at approximate level \(\alpha\) when \(W\) is above the \(1 - \alpha\) quantile of \(\chi^2_r\); the approximate p-value of an observed \(w\) is \(P(\chi^2_r \ge w)\). The lesson on hypothesis tests covers rejection regions, and the lesson on p-values covers what a p-value does and does not say.
Problems
Each problem has hints and a full solution. Observations are independent, and a p-value "from Wilks' theorem" is the large-sample one, read against \(\chi^2_r\).
Further reading
- G. Casella and R. L. Berger, Statistical Inference, 2nd ed. (Duxbury, 2002), chapter 10, section 10.3, on the asymptotic distribution of likelihood ratio tests.
- L. Wasserman, All of Statistics (Springer, 2004), chapter 10, section 10.6, "The Likelihood Ratio Test."
- S. S. Wilks, "The large-sample distribution of the likelihood ratio for testing composite hypotheses," Annals of Mathematical Statistics 9 (1938).
- S. G. Self and K.-Y. Liang, "Asymptotic properties of maximum likelihood estimators and likelihood ratio tests under nonstandard conditions," Journal of the American Statistical Association 82 (1987), on parameters at the boundary.