[R-sig-ME] LMER vs MLwiN

W Robert Long longrob604 at gmail.com
Fri Feb 17 13:52:45 CET 2012


Hello

I'm new to using mixed models in R. Thus far I've been using MLwiN. I am 
trying to duplicate the results in MLwiN of a logistic mixed effects model.

At the moment I have no covariates, and a data hierarchy of
pupil within class within school within commune with random effects at 
each level above pupil.

There are 9000 observations in total;

300 classes
100 schools
20 communes
These have been set as factors with as.factor(). I'm not sure if this is 
correct as they were not categorical in MLwiN (they were just ints) but 
I was getting this error before I did that:
"Error: length(f1) == length(f2) is not TRUE"

I have tried to fit a model with glmer like this:

glmer(LOSS~(1|COMMUNE/SCHOOL/CLASS/PUPIL),data=dt,family=binomial(link = 
"logit"))

However this generates the error
"Error: cannot allocate vector of size 9.5 Gb"

I have also tried glmmPQL in the MASS package:
glmmPQL(LOSS~1,data=dt, random = 
~1|COMMUNE/SCHOOL/CLASS/PUPIL,family=binomial(link = "logit"))

However this generates /completely/ wrong estimates so I can only assume 
that I am specifying the model incorrectly in R.

If anyone can advise, I would be very grateful
Thanks
RL




More information about the R-sig-mixed-models mailing list