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 STAN using the RStan interface to R.

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, diagnostics and summaries. There’s lots more you can do so these analyses are far from complete.

- Single Random Effect - the
`pulp`

data - One Fixed and One Random Effect - the
`penicillin`

data - Split Plots - the
`irrigation`

data - Nested Effects - the
`eggs`

data - Crossed Effects - the
`abrasion`

data - Multilevel Models - the
`jsp`

data - Longitudinal Models - the
`psid`

data - Repeated Measures - the
`vision`

data - Multiple Response Models - the
`jsp`

data