On Mon, Jun 11, 2012 at 7:00 AM, Tamara <petrova.t...@gmail.com> wrote: > Dear all, > > I am struggling with a problem which I have been reading on the forums about > and it did not seem to me that there is a precise answer to my question. > However, I still hope there is one. > > I am working with http://timss.bc.edu/ PIRLS data and trying to conduct > multilevel analysis. There are different weights for each level of analysis > in the PIRLS dataset (e.g. there is a school weight, class weight, student > weight). > Is there a function in R which would let me use different weights for > different levels of my model? > If yes, which package contains it? >
As far as I know there is no function that does what you want. In particular, lme() and lmer() don't work correctly with sampling weights. It does depend on why you want a multilevel model. If you are primarily interested in the mean model and the variance components are just needed to get appropriate standard errors, then you can use the svyglm() function in the survey package to fit a linear regression with appropriate standard errors. On the other hand, if you are interested in estimating the variance components for their own sake, you need some other software. I do have longer-term plans to add multilevel modelling capabilities to the survey package, but it's harder than it may appear. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.