Wilks' theorem

In statistics Wilks' theorem offers an asymptotic distribution of the log-likelihood ratio statistic, which can be used to produce confidence intervals for maximum-likelihood estimates or as a test statistic for performing the Likelihood-ratio test.

Statistical tests (such as hypothesis testing) generally require knowledge of the probability distribution of the test statistic. This is often a problem for likelihood ratios, where the probability distribution can be very difficult to determine.

A convenient result by Samuel S. Wilks says that as the sample size approaches ${\displaystyle \infty }$, the distribution of the test statistic ${\displaystyle -2\log(\Lambda )}$ asymptotically approaches the chi-squared (${\displaystyle \chi ^{2}}$) distribution under the null hypothesis ${\displaystyle H_{0}}$. [1] Here, ${\displaystyle \Lambda }$ denotes the likelihood ratio, and the ${\displaystyle \chi ^{2}}$ distribution has degrees of freedom equal to the difference in dimensionality of ${\displaystyle \Theta }$ and ${\displaystyle \Theta _{0}}$, where ${\displaystyle \Theta }$ is the full parameter space and ${\displaystyle \Theta _{0}}$ is the subset of the parameter space associated with ${\displaystyle H_{0}}$. This result means that for a great variety of hypotheses, a practitioner can compute the likelihood ratio ${\displaystyle \Lambda }$ for the data and compare ${\displaystyle -2\log(\Lambda )}$ to the ${\displaystyle \chi ^{2}}$ value corresponding to a desired statistical significance as an approximate statistical test.

The theorem no longer applies when any one of the estimated parameters is at its upper or lower limit: Wilks’ theorem assumes that the "true" but unknown values of the estimated parameters lie within the interior of the supported parameter space. The likelihood maximum may no longer have the assumed ellipsoidal shape if the maximum value for the population likelihood function occurs at some boundary-value of one of the parameters, i.e. on an edge of the parameter space. In that event, the likelihood test will still be valid and optimal as guaranteed by the Neyman-Pearson lemma, but the significance (the p-value) can not be reliably estimated using the chi-squared distribution with the number of degrees of freedom prescribed by Wilks.

Use

Each of the two competing models, the null model and the alternative model, is separately fitted to the data and the log-likelihood recorded. The test statistic (often denoted by D) is twice the log of the likelihoods ratio, i.e., it is twice the difference in the log-likelihoods:

{\displaystyle {\begin{aligned}D&=-2\ln \left({\frac {\text{likelihood for null model}}{\text{likelihood for alternative model}}}\right)\\[5pt]&=2\ln \left({\frac {\text{likelihood for alternative model}}{\text{likelihood for null model}}}\right)\\[5pt]&=2\times [\ln({\text{likelihood for alternative model}})-\ln({\text{likelihood for null model}})]\\[5pt]\end{aligned}}}

The model with more parameters (here alternative) will always fit at least as well—i.e., have the same or greater log-likelihood—than the model with fewer parameters (here null). Whether the fit is significantly better and should thus be preferred is determined by deriving how likely (p-value) it is to observe such a difference D by chance alone, if the model with less parameters were true. Where the null hypothesis represents a special case of the alternative hypothesis, the probability distribution of the test statistic is approximately a chi-squared distribution with degrees of freedom equal to ${\displaystyle df_{\text{alt}}-df_{\text{null}}}$ ,[2] respectively the number of free parameters of models alternative and null.

For example: If the null model has 1 parameter and a log-likelihood of −8024 and the alternative model has 3 parameters and a log-likelihood of −8012, then the probability of this difference is that of chi-squared value of ${\displaystyle 2\times (-8012-(-8024))=24}$  with ${\displaystyle 3-1=2}$  degrees of freedom, and is equal to ${\displaystyle 6\times 10^{-6}}$ . Certain assumptions[1] must be met for the statistic to follow a chi-squared distribution, but empirical p-values may also be computed if those conditions are not met.

Examples

Coin tossing

An example of Pearson's test is a comparison of two coins to determine whether they have the same probability of coming up heads. The observations can be put into a contingency table with rows corresponding to the coin and columns corresponding to heads or tails. The elements of the contingency table will be the number of times each coin came up heads or tails. The contents of this table are our observations X.

${\displaystyle {\begin{array}{c|cc}X&{\text{Heads}}&{\text{Tails}}\\\hline {\text{Coin 1}}&k_{\mathrm {1H} }&k_{\mathrm {1T} }\\{\text{Coin 2}}&k_{\mathrm {2H} }&k_{\mathrm {2T} }\end{array}}}$

Here Θ consists of the possible combinations of values of the parameters ${\displaystyle p_{\mathrm {1H} }}$ , ${\displaystyle p_{\mathrm {1T} }}$ , ${\displaystyle p_{\mathrm {2H} }}$ , and ${\displaystyle p_{\mathrm {2T} }}$ , which are the probability that coins 1 and 2 come up heads or tails. In what follows, ${\displaystyle i=1,2}$  and ${\displaystyle j=\mathrm {H,T} }$ . The hypothesis space H is constrained by the usual constraints on a probability distribution, ${\displaystyle 0\leq p_{ij}\leq 1}$ , and ${\displaystyle p_{i\mathrm {H} }+p_{i\mathrm {T} }=1}$ . The space of the null hypothesis ${\displaystyle H_{0}}$  is the subspace where ${\displaystyle p_{1j}=p_{2j}}$ . Writing ${\displaystyle n_{ij}}$  for the best estimates of ${\displaystyle p_{ij}}$  under the hypothesis H, the maximum likelihood estimate is given by

${\displaystyle n_{ij}={\frac {k_{ij}}{k_{i\mathrm {H} }+k_{i\mathrm {T} }}}.}$

Similarly, the maximum likelihood estimates of ${\displaystyle p_{ij}}$  under the null hypothesis ${\displaystyle H_{0}}$  are given by

${\displaystyle m_{ij}={\frac {k_{1j}+k_{2j}}{k_{\mathrm {1H} }+k_{\mathrm {2H} }+k_{\mathrm {1T} }+k_{\mathrm {2T} }}},}$

which does not depend on the coin i.

The hypothesis and null hypothesis can be rewritten slightly so that they satisfy the constraints for the logarithm of the likelihood ratio to have the desired nice distribution. Since the constraint causes the two-dimensional H to be reduced to the one-dimensional ${\displaystyle H_{0}}$ , the asymptotic distribution for the test will be ${\displaystyle \chi ^{2}(1)}$ , the ${\displaystyle \chi ^{2}}$  distribution with one degree of freedom.

For the general contingency table, we can write the log-likelihood ratio statistic as

${\displaystyle -2\log \Lambda =2\sum _{i,j}k_{ij}\log {\frac {n_{ij}}{m_{ij}}}.}$

Invalid for random or mixed effects models

Wilks’ theorem assumes that the true but unknown values of the estimated parameters are in the interior of the parameter space. This is commonly violated in random or mixed effects models, for example, when one of the variance components is negligible relative to the others.

In some such cases, one variance component is essentially zero relative to the others or the models are not properly nested. To be clear: These limitations on Wilks’ theorem do not negate any power properties of a particular likelihood ratio test. The only issue is that a ${\displaystyle \chi ^{2}}$  distribution is sometimes not appropriate for determining the statistical significance of the result.

Pinheiro and Bates showed that the true distribution of this likelihood ratio chi-square statistic could be substantially different from the naïve ${\displaystyle \chi ^{2}}$  – often dramatically so.[3] The naïve assumptions could give significance probabilities (p-values) that are far too large on average in some cases and far too small in others. In general, to test random effects, they recommend using Restricted maximum likelihood (REML). For fixed effects testing, they say, “a likelihood ratio test for REML fits is not feasible”, because changing the fixed effects specification changes the meaning of the mixed effects, and the restricted model is therefore not nested within the larger model.[3] As a demonstration, they set either one or two random effects variances to zero in simulated tests. In those particular examples, the simulated p-values with k restrictions most closely matched a 50–50 mixture of ${\displaystyle \chi ^{2}(k)}$  and ${\displaystyle \chi ^{2}(k-1)}$ . (With k = 1, ${\displaystyle \chi ^{2}(0)}$  is 0 with probability 1. This means that a good approximation was ${\displaystyle 0.5\chi ^{2}(1)}$ .)[3]

Pinheiro and Bates also simulated tests of different fixed effects. In one test of a factor with 4 levels (degrees of freedom = 3), they found that a 50–50 mixture of ${\displaystyle \chi ^{2}(3)}$  and ${\displaystyle \chi ^{2}(4)}$  was a good match for actual p-values obtained by simulation – and the error in using the naïve ${\displaystyle \chi ^{2}(3)}$  “may not be too alarming.”[3]

However, in another test of a factor with 15 levels, they found a reasonable match to ${\displaystyle \chi ^{2}(18)}$  – 4 more degrees of freedom than the 14 that one would get from a naïve (inappropriate) application of Wilks’ theorem, and the simulated p-value was several times the naïve ${\displaystyle \chi ^{2}(14)}$ . They conclude that for testing fixed effects, “it's wise to use simulation.”[4]