Inference for linear mixed models can be difficult. In 2005, I published Extending the Linear Model with R that has two 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. I have presented some alternative methods of inference using several packages pbkrtest, RLRsim, lmerTest and MCMCglmm. In the forthcoming (spring 2016) second edition of Extending the Linear Model with R, the use of pbkrtest and RLRsim is integrated into text. I will also add a chapter on the Bayesian approach to this class of models using STAN and INLA

Here I explore the use of INLA. STAN analyses of the same data is also available. I haven’t attempted to specify exactly the same priors for the corresponding INLA and STAN examples (partly because this is not so easy to do). In comparing the results, one should also consider that both INLA and STAN involve approximations. INLA uses mathematical approximations and STAN has simulation approximations.

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. I’ve focussed attention on the process for fitting the model and summaries. There’s lots more you can do so these analyses are far from complete.