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).

  • 4
    $\begingroup$ R and S-Plus are very similar, but definitely not the same (I know from painful experience!). $\endgroup$
    – Shane
    Commented Aug 25, 2010 at 13:44

1 Answer 1


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.

  • $\begingroup$ Thanks. It worked - this way I can plot both the Class random effects (level=1), and the student (level=2). $\endgroup$
    – Amanda
    Commented Aug 27, 2010 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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