[R-sig-ME] Modelling random effects for only part of the observations (in lme4)

Hufthammer, Karl Ove karl.ove.hufthammer at helse-bergen.no
Fri Jan 16 10:37:43 CET 2015

Thierry ONKELINX wrote:
> Dear Karl Ove,
> (X|G) is equivalent to (1 + X|G). Or mathematically: b_0i + b_1iX. But you need b_1iX.
> The solution is to remove the random intercept (0 + X|G)
> I would go for lmer(y ~ arm + (0 + b|gr2))

Great! Thanks. This works perfectly.

And I now understand what's going on in the formula too. The lme4 syntax is rather elegant. :)

The fixed effect estimates are near identical to estimates based on lm(y ~ arm), while the standard errors are different, which is exactly what would be expected. The reason they're not exactly identical is that one treatment group had only 2 subjects, so the design was not perfectly balanced. If I change it to a balanced design (equal number of subjects in each treatment group), the estimates are identical between lmer and lm (while of course the standard errors still differ).

Karl Ove Hufthammer

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