Analyzing educational datasets we have samples of children from samples of class in samples of schools - we have sampling weights, so I use the survey package e.g. to do a linear model. But this kind of design also requires looking at the mixed effects. But this isn’t possible using the survey package. I can do this in nlme – but then I don't know how to account for the weighting. I guess I could use the sample weights as predictors in nlme regressions but I don’t think that is correct.

It seems that this kind of design (in fact any stratified survey sample which includes nested levels) needs analysing from both perspectives – (survey weights and mixed effects) at once – but the packages of choice for each of these perspectives, survey and nlme, each don’t seem to have slots for the other perspective.

Can someone put me on the right track, or suggest another package which does both at the same time?


1 Answer 1


I have looked at this recently, and concluded that nothing works in R the way I wanted to. So I analyzed my multilevel complex survey data in Stata using gllamm package, which can account for weights at multiple levels and clustering (but still can't do stratification). I would be happy to hear of otherwise available packages, but generally the multilevel people and the survey people do not overlap that much.

  • $\begingroup$ I know you posted this a few years ago. Since then have you had any luck using sampling weights with mixed effects models in R? I'm particularly interested in using them with the Ordinal package and clmm() function. $\endgroup$
    – RNB
    Nov 15, 2016 at 7:08
  • $\begingroup$ I have not looked back in a long while; I think last time I looked was in 2014. $\endgroup$
    – StasK
    Dec 9, 2016 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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