This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)(Learn how and when to remove this template message)
If the distribution of the likelihood ratio corresponding to a particular null and alternative hypothesis can be explicitly determined then it can directly be used to form decision regions (to accept/reject the null hypothesis). In most cases, however, the exact distribution of the likelihood ratio corresponding to specific hypotheses is very difficult to determine.
A convenient result by Samuel S. Wilks, says that as the sample size approaches , the test statistic for a nested model asymptotically will be chi-squared distributed () with degrees of freedom equal to the difference in dimensionality of and , when holds true. This means that for a great variety of hypotheses, a practitioner can compute the likelihood ratio for the data and compare to the value corresponding to a desired statistical significance as an approximate statistical test.
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 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 – often dramatically so. 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. 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 and . (With k = 1, is 0 with probability 1. This means that a good approximation was .)
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 and was a good match for actual p-values obtained by simulation – and the error in using the naïve “may not be too alarming. However, in another test of a factor with 15 levels, they found a reasonable match to – 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 .” They conclude that for testing fixed effects, it's wise to use simulation.
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:
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 the probability or p-value of the difference D. 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 , 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 with degrees of freedom, and is equal to . Certain assumptions 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.
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.
Here Θ consists of the possible combinations of values of the parameters , , , and , which are the probability that coins 1 and 2 come up heads or tails. In what follows, and . The hypothesis space H is constrained by the usual constraints on a probability distribution, , and . The space of the null hypothesis is the subspace where . Writing for the best estimates of under the hypothesis H, the maximum likelihood estimate is given by
Similarly, the maximum likelihood estimates of under the null hypothesis are given by
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 , the asymptotic distribution for the test will be , the distribution with one degree of freedom.
For the general contingency table, we can write the log-likelihood ratio statistic as
- Wilks 1938.
- Pinheiro, José C. & Bates, Douglas M. (2000). Mixed-Effects Models in S and S-PLUS. Berlin/Heidelberg: Springer-Verlag. pp. 82–93. ISBN 0-387-98957-9
- And they provided a “simulate.lme” function in their “nlme” package for S-PLUS and R to support doing that, see "Simulate Results from lme Models" (PDF). Package ‘nlme’. April 7, 2018. pp. 280–281.
- Huelsenbeck & Crandall 1997.
- Casella, George; Berger, Roger L. (2001). Statistical Inference (Second ed.). ISBN 0-534-24312-6.
- Cox, D. R.; Hinkley, D. V. (1974). Theoretical Statistics. Chapman and Hall. ISBN 0-412-12420-3.
- Huelsenbeck, J. P.; Crandall, K. A. (1997). "Phylogeny Estimation and Hypothesis Testing Using Maximum Likelihood". Annual Review of Ecology and Systematics. 28: 437–466. doi:10.1146/annurev.ecolsys.28.1.437.
- Mood, A.M.; Graybill, F.A. (1963). Introduction to the Theory of Statistics (2nd ed.). McGraw-Hill. ISBN 978-0070428638.
- Neyman, Jerzy; Pearson, Egon S. (1933). "On the Problem of the Most Efficient Tests of Statistical Hypotheses" (PDF). Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences. 231 (694–706): 289–337. Bibcode:1933RSPTA.231..289N. doi:10.1098/rsta.1933.0009. JSTOR 91247.
- Pinheiro, José C.; Bates, Douglas M. (2000), Mixed-Effects Models in S and S-PLUS, Springer-Verlag, pp. 82–93, ISBN 0-387-98957-9
- Stuart, A.; Ord, K.; Arnold, S (1999). Kendall's Advanced Theory of Statistics. 2A. Arnold.
- Wilks, S. S. (1938). "The Large-Sample Distribution of the Likelihood Ratio for Testing Composite Hypotheses". The Annals of Mathematical Statistics. 9: 60–62. doi:10.1214/aoms/1177732360.