Mixed models – Part 2: lme lmer

Getting more into mixed models, I’ve been playing around with both nlme::lme and lme4::lmer. http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3345.html was quite a good post at explaining the differences, which from what I gather is largely performance based when using crossed or partially crossed models.

In the models I am tinkering with at the moment I am noticing differences in the standard deviations for the coefficients, which is alarming, but I’ll continue to dig around.

Advertisements

Mixed Models – Part 1

Very brief. Have been exploring mixed models in R using nlme::lme. Am looking forward to understanding them more, they’re going to be used more and more in years to come I’ve no doubt of that.

Here are some scripts, very rough, for diagnostics when running simple 2 levels, or models with 1 grouping variable.

Update – Nov 2013
https://github.com/nzcoops/r-code
The site I was hosting the code on closed, scripts are now available on my github.

To use simply run:
source("..my_directoy/mixed_model_diag_1_v1.0.R")
then:
mm.diag.1(my.model)
where ‘my.model’ is the output of an ‘lme’.

This code is derived largely from code prepared by Andrew Robinson whose guide icebreakeR is freely available and a highly recommended read for both R beginneRs or experienced R users looking to dabble in mixed models for the first time http://www.ms.unimelb.edu.au/~andrewpr/r-users/. I take 0 credit for this code.