[R-sig-ME] multilevel analysis with sample weighted data

Ben Bolker bbolker at gmail.com
Thu Aug 28 15:52:58 CEST 2014


On 14-08-28 07:01 AM, Rodrigo Travitzki wrote:
> Dear R masters,
> I'm looking for a R package to do multilevel analysis of a weighted data
> (is a weigthed sample of brazilian educational data) but could not find
> it. There is just a "weights" option in lme(), but is not about
> frequency (or probability) weigths in data. In some foruns, no response
> either.
> So, could you please confirm this information for me? There is any R
> package/function which do this? I really don't want to use proprietary
> software, but if there is no option, I'll need to do so.
> Thank you very much.
> 
> Best wishes,
> Rodrigo Travitzki

  It depends a little bit what you want to do/the meaning of the
weights.  I have successfully used weights=varFixed(~I(1/n))
[inverse-variance weighting based on the number of samples per group] in
lme; alternatively, you could use weights=n in lmer (from the lme4
package) to get an equivalent result.

If you want to deal with survey weighting, the story seems to be
considerably more complicated -- I don't claim to understand it, but
Andrew Gelman (a fairly prominent applied Bayesian statistician) claims
that it's "a mess" (to use his phrase).  If the weights represent
probability of inclusion in a survey, I believe he would recommend
model-based inference -- that is, fit an unweighted multilevel
regression model and then use post-stratification/weighting to make
predictions (see http://andrewgelman.com/?s=survey+weights for various
discussion and links to papers).

  good luck,
    Ben Bolker



More information about the R-sig-mixed-models mailing list