Inference for mixed effect models is difficult. In 2005, I published Extending the Linear Model with R (Faraway 2006) that has three chapters on these models. The inferential methods described in that book and implemented in the lme4 as available at the time of publication were based on some approximations. In some simple balanced cases, the inference is exactly correct, in other cases the approximation is adequate and in yet other cases the approximation is poor and the results could be misleading. It is not easy to specify when the approximations are adequate or better, so the author of the package made the decision to withdraw these methods entirely. Unfortunately this left readers of my text wondering why the output from current R implementations did not provide the inferential results presented in the text.

I have gathered together in Changes to the Mixed Effects Models chapters in ELM (PDF) a summary of what is different from current lme4 and 2005 lme4.

In recent years, several R packages have presented alternative methods for performing the inference.

  One of the most frequently asked questions about 'lme4' is "how do
I calculate p-values for estimated parameters?" Previous versions
of `lme4` provided the `mcmcsamp` function, which efficiently
generated a Markov chain Monte Carlo sample from the posterior
distribution of the parameters, assuming flat (scaled likelihood)
priors. Due to difficulty in constructing a version of 'mcmcsamp'
that was reliable even in cases where the estimated random effect
variances were near zero (e.g.  <>
`mcmcsamp` has been withdrawn (or more precisely, not updated to
work with `lme4` versions greater than 1.0.0).

Worked Examples

I demonstrate these methods for each of the examples in the text. You’ll need to read the text for more background on datasets and the interpretations or you can just look at the help pages for the datasets.


Faraway, J. 2006. Extending the Linear Model with R. London: Chapman; Hall.

Gelman, A., J. Carlin, H. Stern, D. Dunson, A. Vehtari, and D. Rubin. 2014. Bayesian Data Analysis. 3rd ed. London: Chapman; Hall.

Hadfield, Jarrod D. 2010. “MCMC Methods for Multi-Response Generalized Linear Mixed Models: The MCMCglmm R Package.” Journal of Statistical Software 33 (2): 1–22.

Halekoh, Ulrich, and Søren Højsgaard. 2014. “A Kenward-Roger Approximation and Parametric Bootstrap Methods for Tests in Linear Mixed Models – the R Package Pbkrtest.” Journal of Statistical Software 59 (9): ??–??

Kenward, MG, and JH Roger. 1997. “Small Sample Inference for Fixed Effects from Restricted Maximum Likelihood.” Biometrics 53 (3): 983–97.

Scheipl, Fabian, Sonja Greven, and Helmut Kuechenhoff. 2008. “Size and Power of Tests for a Zero Random Effect Variance or Polynomial Regression in Additive and Linear Mixed Models.” Computational Statistics & Data Analysis 52 (7): 3283–99.