[R-sig-ME] Using weights properly in lmer

Joehanes, Roby (NIH/NHLBI) [F] roby.joehanes at nih.gov
Wed Sep 5 16:42:56 CEST 2012

Hi all:

I hope this does not get asked very often, but I am somewhat confused of how weights can be used in lmer. Specifically, as shown here:

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) )
(fm2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, weights = w) )
(fm3 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, weights = w/sum(w)) )

I still found the same problems as in the above URL even with the latest lmer from the Subversion.

My particular goal is to use the weights to offset the heteroscedasticity. That is, I have a matrix, say, A, of m x n. Then,

y <- as.numeric(A)
wt <- rep(1.0/apply(A,1,var), n)

What I want is to run:
result <- lmer(y ~ ...some covariates..., weights = wt)

But the result is strange. The problem is like the above. Is this a bug? Or is there any convention I need to know? Please advise.

Thank you,

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