Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I am modelling a nested mixed-effects model with just the intercept in the random part, of the form:

fit4<-lme(fixed = Stdquad~factor(LayoutN)+factor(nCHIPS.fixed), random = ~1|Class.Ordered/student)

When trying to check the assumption on the independent, identically distributed (iid) random effects in SPlus using ranef(), I keep getting the error:

Problem in sort.list: ordering not defined for mode "list": sort.list(x, partial)

I suspect the nesting is the problem since if I remove student, the plots come up fine.

I would like to know how I can check that the random effects are iid and are independent for different groups using S-Plus (or R since its very similar).

share|improve this question
3  
R and S-Plus are very similar, but definitely not the same (I know from painful experience!). – Shane Aug 25 '10 at 13:44

1 Answer

up vote 5 down vote accepted

It seems you are using the nlme package. Maybe it would be worth trying R and the lme4 instead, although it is not fully comparable wrt. syntax or function call.

In your case, I would suggest to specify the level when you called ranef(), see ?ranef.lme:

   level: an optional vector of positive integers giving the levels of
          grouping to be used in extracting the random effects from an
          object with multiple nested grouping levels. Defaults to all
          levels of grouping.

This is also present in the official documentation for NLME 3.0 (e.g., p. 17).

Check out Douglas Bates's neat handouts on GLMM. He is also writing a textbook entitled lme4: Mixed-effects modeling with R. All are available on R-forge.

share|improve this answer
Thanks. It worked - this way I can plot both the Class random effects (level=1), and the student (level=2). – Amanda Aug 27 '10 at 11:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.