Modelcore
Linear mixed model
Also called mixed-effects model, random effects model, hierarchical linear model.
A linear model y = X b + Z u + e with fixed effects b and random effects u. It models grouped or repeated measures with correlated errors.
A linear mixed model, or mixed-effects model, is a linear regression in which part of the coefficients are fixed unknown numbers and part are random variables with mean 0. In matrix form , where is the vector of fixed effects (on this page the coefficient vector is written ), is the vector of random effects and is the error. The random effects make the observations of the same group, subject or plot correlated, so the model fits clustered data, repeated measures and longitudinal studies, split plots, and genetic evaluation of animals. Given the covariance parameters, is estimated by generalized least squares and is predicted by BLUP, both from Henderson's mixed model equations. The covariance parameters themselves are usually estimated by restricted maximum likelihood.
The machine
Data. A response , a fixed-effects design (, rank , usually with an intercept column) and a random-effects design ().
Model.
The matrices and depend on a short vector of covariance parameters. The commonest choice is , and block diagonal with one block for each random factor.
The marginal law. Since is a linear function of the independent normal vectors and ,
All inference on and uses this law; is not a parameter and is predicted, not estimated.
Parameter space. , and in the set where is positive semidefinite and is positive definite. A variance component equal to 0 is allowed, and it is a boundary point of this set.
Common layouts.
- Random intercepts (one-way). Groups with observations, , , . Here is the matrix of group indicators and .
- Random intercepts and slopes (Laird and Ware 1982). For subject , with and ; for a straight line in time, has columns and the times, and is a covariance matrix.
- Nested and crossed factors. Pupils in classes in schools give nested blocks of ; subjects crossed with test items give two random factors whose indicators overlap, and has no block diagonal form.
- Known relationships. In animal breeding , where is the matrix of additive relationships computed from the pedigree.
What it counts
- The fixed effects . In a linear mixed model , so is both the effect within a group and the effect averaged over the population. (In a mixed model with a nonlinear link these two differ.)
- The variance components , for example and , and functions of them such as the intraclass correlation .
- The predicted random effects , the best linear unbiased predictor, and predictions such as for a known group. In the one-way layout, : the group mean is pulled toward the overall mean, more for small groups.
- Standard errors from and from the prediction error variance of , both at the true ; plugging in makes them too small in small samples.
Relation to other models
- Ordinary least squares is the case , .
- Generalized least squares is the case of a known . The mixed model gives a structure with few parameters, so that it can be estimated.
- Fixed group effects. Treating the as fixed (one indicator column for each group) is the limit of the mixed model; then becomes the plain group mean minus the overall mean, and the model cannot estimate effects of variables that are constant within groups.
- Ridge regression. With and , the BLUP of is the ridge estimate with penalty , as Henderson's equations show. Penalized splines and smoothing splines can be written as mixed models in the same way, so REML chooses their smoothing parameter.
- Bayesian models. With a flat prior on and known, the posterior mean of is the BLUP. Putting a prior on as well gives a hierarchical Bayesian model; plugging in an estimate is empirical Bayes.
- Kriging and Gaussian processes. A spatial process with a parametric covariance is a mixed model with ; the kriging predictor is the BLUP, and universal kriging estimates the mean by GLS.
- Marginal models. Generalized estimating equations and cluster-robust standard errors target only and do not need the normal law or a model for ; they give no predictions of group effects.
- One-way ANOVA with a random factor is the balanced one-way layout below.
- Survival data. A random effect inside a hazard model is a frailty model. Non-normal responses with random effects in a generalized linear model need numerical integration or a Laplace approximation for the likelihood.
Known results in the model
1. Within-group correlation (proved here). In the one-way layout, , for , and observations in different groups are independent. Proof. by independence of and ; the first term is when and 0 otherwise, the second is when and 0 otherwise. So each block of has the compound symmetry form , and the correlation of two observations in one group is . A test or interval that treats the observations as independent uses the wrong variance: the variance of a group mean is , and the part does not shrink with .
2. Estimation and prediction for known . The GLS estimate is the maximum likelihood estimate of and the best linear unbiased estimator (Aitken). The predictor has the smallest mean squared error among linear predictors with for all (Henderson 1975). Both come from one linear system; the proofs are on the mixed model equations page.
3. The balanced one-way layout (proved here). Let for all groups and . Let with degrees of freedom and with , and , the mean squares. Then and , and they are independent.
Proof. Write . The within deviations do not involve , and for each the vector is independent of (the sample mean and the deviations of a normal sample are independent), so is a sum of independent variables. The group means are functions of and the only, hence independent of , and they are iid . So , which is the claim for .
So and , and the ANOVA estimator is unbiased. It is negative exactly when . With , the ratio has the law, so
For and this is 0.595, 0.562, 0.539 and 0.521 for . For and it is 0.066. W. A. Thompson (1962) and Searle, Casella and McCulloch discuss what to do with a negative estimate; REML and ML both return 0 instead, as the REML page shows.
4. Testing a variance component on the boundary. The null is on the edge of the parameter space, so Wilks' theorem does not apply. When the data have many independent groups, the likelihood ratio statistic for one variance component has the limit law under the null (Chernoff 1954; Self and Liang 1987): with probability , as when the estimate falls on the boundary, and otherwise . The right p-value is half the tail, for , and the 5% cut is 2.706 instead of 3.841. For a random slope added to a random intercept, the limit is (Stram and Lee 1994). The test is conservative. In the balanced example with , the REML fits give , so the p-value is 0.0085 and the mixture p-value is 0.0043.
The mixture is a large-sample result in the number of groups. In the balanced layout the restricted likelihood ratio is 0 exactly when , so by Result 3 its mass at 0 under the null is , the values above. This tends to only as ; with fixed and it tends to , which is for . Crainiceanu and Ruppert (2004) give the exact finite sample law for one variance component and show cases where the mass at 0 is far above . A parametric bootstrap under the null fit is a safe check.
5. Tests of fixed effects. Wald and tests for use , which ignores the error in . The Kenward-Roger (1997) correction adjusts this covariance and the degrees of freedom of the reference law. Likelihood ratio tests of fixed effects use maximum likelihood fits, not REML fits.
References
- Nan M. Laird and James H. Ware, Random-effects models for longitudinal data, Biometrics 38(4), 1982, pp. 963 to 974, The whole paper (the two-stage model y_i = X_i b + Z_i u_i + e_i for repeated measures, and its fit by EM with ML and REML)
- C. R. Henderson, Best linear unbiased estimation and prediction under a selection model, Biometrics 31(2), 1975, pp. 423 to 447, The mixed model equations and the BLUE and BLUP they give
- G. K. Robinson, That BLUP is a good thing: the estimation of random effects, Statistical Science 6(1), 1991, pp. 15 to 32, The whole paper (derivations of BLUP, its links to Bayes, kriging and smoothing, and the one-way example)
- David A. Harville, Maximum likelihood approaches to variance component estimation and to related problems, Journal of the American Statistical Association 72(358), 1977, pp. 320 to 338, The whole paper (ML and REML for the mixed model, their properties and algorithms)
- Steven G. Self and Kung-Yee Liang, Asymptotic properties of maximum likelihood estimators and likelihood ratio tests under nonstandard conditions, Journal of the American Statistical Association 82(398), 1987, pp. 605 to 610, The mixture of chi-squared laws for a parameter on the boundary, case 5 (one variance component)
- Daniel O. Stram and Jae Won Lee, Variance components testing in the longitudinal mixed effects model, Biometrics 50(4), 1994, pp. 1171 to 1177, The whole paper (the mixtures for tests of random intercepts and random slopes)
- Ciprian M. Crainiceanu and David Ruppert, Likelihood ratio tests in linear mixed models with one variance component, Journal of the Royal Statistical Society Series B 66(1), 2004, pp. 165 to 185, The whole paper (the exact finite sample null law of the LR and restricted LR statistics, and when the 50:50 mixture fails)
- Michael G. Kenward and James H. Roger, Small sample inference for fixed effects from restricted maximum likelihood, Biometrics 53(3), 1997, pp. 983 to 997, The whole paper (the adjusted covariance and the F approximation for tests of fixed effects)
- Shayle R. Searle, George Casella and Charles E. McCulloch, Variance Components, Wiley, 1992, Chapter 3 (the balanced one-way classification, ANOVA estimators and their distributions) and Chapter 7 (prediction of random variables, BLUP)
- José C. Pinheiro and Douglas M. Bates, Mixed-Effects Models in S and S-PLUS, Springer, 2000, Chapters 1 and 2 (the model, ML and REML, tests of variance components on the boundary)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag RBPBWM Edit this page History Report an error Markdown