Hexa Scholar

Likelihood ratio tests and Wilks' theorem

A gold balance with a clay landscape of three hills on one pan and the same landscape with its middle hill pressed flat on the other; the beam tilts slightly.
Two almost identical landscapes on a balance.

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. 1 SeePick a law, then run 2,000 studies.
  2. 2 TryTest small samples and an edge case.
  3. 3 ProveBuild the one-parameter proof, line by line.
  4. 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 ideas

W 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.

Null rate:

θ₀ = 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.

Null:

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.

1 See

Which law does W follow?

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.

2 Try

How good is the chi-square cutoff?

A prediction first. The explorer below it opens once it is answered.

An edge case

3 Prove

Why the limit is chi-square: one parameter

Theorem (Wilks, 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.

What else follows
  • 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.
4 Apply

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\).

Key point Fit both models, compute \(W = 2[\ell(\hat\theta) - \ell(\hat\theta_0)]\), count the parameters the null fixes, and read \(W\) against \(\chi^2_r\). Check first that the true parameter under the null is not on the edge of the full model.
Level Intermediate Prerequisites maximum likelihood, chi-square, t and F, p-values Time ~40 min

Further reading