[R] different results from lme() and lmer()

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Jun 1 10:11:38 CEST 2011


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

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
> Namens Taro Miyagawa
> Verzonden: woensdag 1 juni 2011 7:58
> Aan: r-help op r-project.org
> Onderwerp: [R] different results from lme() and lmer()
> 
> 
> 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
> > summary(lme(root~fertilizer,random=~week|plant,data=dat))Linear mixed-
> effects model fit by REML Data: dat        AIC      BIC    logLik  171.0236 183.3863 -
> 79.51181
> 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
> 
> > lmer(root~fertilizer+(week|plant),data=dat)Linear mixed model fit by
> REML Formula: root ~ fertilizer + (week | plant)    Data: dat    AIC BIC logLik
> deviance REMLdev 174.4 187 -81.21    159.7   162.4Random
> effects: Groups   Name        Variance   Std.Dev.   Corr   plant    (Intercept)
> 4.1416e-18 2.0351e-09                 week        8.7452e-01 9.3516e-01
> 0.000  Residual             2.2457e-01 4.7389e-01       Number of obs: 60, groups:
> plant, 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
> 
> ______________________________________________
> R-help op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list