Modelling random effects for only part of the observations (in lme4)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 15-01-16 04:37 AM, Hufthammer, Karl Ove wrote:
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. :)
Can we quote you on that? :-)
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).
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJUuRzdAAoJEOCV5YRblxUHm0wH/13AiAPnPkVMUQkU2dUYQF/p JFjg9bAyBx29BviAJk9kfxxgHcKBTM+mdDrPRrmqwmZXTu6cyuw10VRiwVNsap3s 7h8qd5MnxGFuUUho8cTpHPzgunEHtQu85lFctqEGuSXTmOxOSvL9hCkWl3m7jTLw it79ZuuBG3sO1L96z/nZ/MqRqiubOL3afc14TpW2Bmt3OQjMYWx5bT4bKNIY10/s l3wRoLI4pTjgTVflrH1d+gLBizsyiaX84sPY+OWshv9XCaEZuN0CoxtVvc0tkqoD z3kWyt32LRzELtWNhAm3jUEDK6EK46F5/22XnC3KBfcMlxfZxpVW85mIX5S6UZM= =mTY9 -----END PGP SIGNATURE-----