Skip to content

different results from lme() and lmer()

2 messages · Taro Miyagawa, ONKELINX, Thierry

#
Hello R-help,
I'm studying an example in the R book.?
The data file is available from the link below.http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/fertilizer.txt
Could you explain Why the results from lme() and lmer() are different in the following case? In other examples, I can get the same results using the two functions, but not here...?
Thank you.Miya

library(lme4)library(nlme)# object dat contains the data
Random effects:?Formula: ~week | plant?Structure: General positive-definite, Log-Cholesky parametrization? ? ? ? ? ? StdDev ? ?Corr ?(Intercept) 2.8639832 (Intr)week ? ? ? ?0.9369412 -0.999Residual ? ?0.4966308 ? ? ??
Fixed effects: root ~ fertilizer?? ? ? ? ? ? ? ? ? ? ? Value Std.Error DF ? t-value p-value(Intercept) ? ? ? ?2.799710 0.1438367 48 19.464499 ? 0e+00fertilizercontrol -1.039383 0.2034158 10 -5.109645 ? 5e-04?Correlation:?? ? ? ? ? ? ? ? ? (Intr)fertilizercontrol -0.707
Standardized Within-Group Residuals:? ? ? ?Min ? ? ? ? Q1 ? ? ? ?Med ? ? ? ? Q3 ? ? ? ?Max?-1.9928118 -0.6586834 -0.1004301 ?0.6949714 ?2.0225381?
Number of Observations: 60Number of Groups: 12?
Fixed effects:? ? ? ? ? ? ? ? ? Estimate Std. Error t value(Intercept) ? ? ? ?-0.1847 ? ? 0.2024 ?-0.913fertilizercontrol ?-0.7612 ? ? 0.2862 ?-2.660
Correlation of Fixed Effects:? ? ? ? ? ? (Intr)frtlzrcntrl -0.707
#
Dear Miya,

Notice the very strong negative correlation between the random intercept and the random slope in the lme() model. That is usually an indication of problems (in this case overfitting). If you drop the random slope, then both models yield the same parameters.

Plotting the data reviels a much better model specification.

dat <- read.table(file = "http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/fertilizer.txt", header = TRUE)
library(ggplot2)
ggplot(dat, aes(x = week, y = root, group = plant, colour = fertilizer)) + geom_line()

lmer(root~fertilizer + week +(1|plant),data=dat)

Best regards,

Thierry

PS Use R-sig-mixedmodels for questions on mixed models