Andrew Robinson
2006-Dec-10 20:21 UTC
[R] lmer, gamma family, log link: interpreting random effects
Dear all, I'm curious about how to interpret the results of the following code. The first model is directly from the help page of lmer; the second is the same model but using the Gamma family with log link. The fixed effects make sense, because y = 251.40510 + 10.46729 * Days is about the same as log(y) = 5.53613298 + 0.03502057 * Days but the random effects seem quite disproportionate. Am I missing something obvious, or is this a bug? Cheers Andrew> require(lme4) > fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) > fixef(fm1)(Intercept) Days 251.40510 10.46729> ranef(fm1)An object of class "ranef.lmer" [[1]] (Intercept) Days 308 2.2713451 9.1966961 309 -40.3825921 -8.6223099 310 -38.9403378 -5.4521894 330 23.6656443 -4.8100611 331 22.2391295 -3.0662861 332 9.0324969 -0.2709760 333 16.8277808 -0.2214775 334 -7.2256113 1.0733822 335 -0.3503176 -10.7492136 337 34.8784025 8.6302064 349 -25.1898574 1.1699674 350 -13.0500361 6.6107496 351 4.5697621 -3.0138529 352 20.8539011 3.5376139 369 3.2744289 0.8723798 370 -25.5865985 4.8179542 371 0.8049003 -0.9877807 372 12.3075594 1.2851975> fm1.g.log <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, family=Gamma(link="log")) > fixef(fm1.g.log)(Intercept) Days 5.53613298 0.03502057> ranef(fm1.g.log)An object of class "ranef.lmer" [[1]] (Intercept) Days 308 6.817799e-10 4.462209e-09 309 -1.367226e-09 -6.921681e-09 310 -1.120295e-09 -5.303576e-09 330 1.173973e-10 -6.049948e-10 331 2.104704e-10 1.531865e-10 332 1.501432e-10 6.721697e-10 333 3.048322e-10 1.103687e-09 334 -6.193655e-11 -7.056224e-11 335 -7.539673e-10 -4.999876e-09 337 1.263556e-09 6.502735e-09 349 -3.974501e-10 -1.294252e-09 350 2.112016e-10 2.125564e-09 351 -1.220139e-10 -1.095394e-09 352 6.412044e-10 3.215876e-09 369 1.231353e-10 6.292502e-10 370 -1.520576e-10 4.003904e-10 371 -5.220764e-11 -4.587212e-10 372 3.234287e-10 1.484018e-09 -- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/