Multi-stage sampling together with hierarchical/ mixed effects models: which packages?

Dear R experts,
I sent this question to the r-help list but didn’t get much response, probably because it is more of a stats question. But as this blog is syndicated on r-bloggers I thought I would try it again here on this blog. If I am barking up the wrong tree, feel free to flame.

When I have to analyze educational datasets with samples of children from samples of schools and which include sampling weights, I use the survey package e.g. to calculate means and confidence intervals or to do a linear model. But this kind of design (e.g. children nested inside schools) also as I understand it requires looking at the mixed effects. But this isn’t possible using the survey package. Perhaps I am better advised to use nlme – 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.

If someone could put me on the right track I could be more specific with reproducible examples etc

Best Wishes
Steve Powell

7 thoughts on “Multi-stage sampling together with hierarchical/ mixed effects models: which packages?

  1. Nick says:

    Hi Steve, my understanding of this issue is that you would use the hierarchical model to appropriately model the data, and then make any adjustments needed due to survey weighting through post-stratification. This requires that your model includes the criteria which your survey weights distinguish, as well as any interactions that might be important. If you search for ‘survey weights’ on Andrew Gelman’s blog you will probably find a much more distinguished response to this question (hopefully consistent with what I describe above!).

    Good luck – Nick

    • steve says:

      Thanks Nick! Indeed Andrew Gelman’s blog was very useful. I am still reading through.
      Incidentally, I just today found that lavaan, my favourite sem package, now has a sister lavaan.survey which is a wrapper for both lavaan and the survey package. So as sem can do multi-level modelling, this might be another option.

  2. Simon says:

    The asreml package has the capability to do what you want. I’m fairly certain it is free if you are part of an educational institution.

  3. Fmark says:

    Hi Steve,

    I have a similar issue, so if you could post any findings on your r-blogger’s syndicated blog I would be most appreciative!

  4. Hi Steve,
    R-bloggers should not be used for forum questions.
    Your post is removed. Please do not do this again (imagine how the site would look if 10 more bloggers would start asking questions on the site)

    If you will come up with a good answer, THAT would be a good post for r-bloggers :)

    Cheers,
    Tal

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>