[R] lme X lmer results

Ronaldo Reis-Jr. chrysopa at gmail.com
Mon Dec 26 12:49:52 CET 2005

```Hi,

this is not a new doubt, but is a doubt that I cant find a good response.

Look this output:

> m.lme <- lme(Yvar~Xvar,random=~1|Plot1/Plot2/Plot3)

> anova(m.lme)
numDF denDF  F-value p-value
(Intercept)     1   860 210.2457  <.0001
Xvar	        1     2   1.2352  0.3821
> summary(m.lme)
Linear mixed-effects model fit by REML
Data: NULL
AIC      BIC    logLik
5416.59 5445.256 -2702.295

Random effects:
Formula: ~1 | Plot1
(Intercept)
StdDev: 0.000745924

Formula: ~1 | Plot2 %in% Plot1
(Intercept)
StdDev: 0.000158718

Formula: ~1 | Plot3 %in% Plot2 %in% Plot1
(Intercept) Residual
StdDev: 0.000196583 5.216954

Fixed effects: Yvar ~ Xvar
Value Std.Error  DF  t-value p-value
(Intercept)    2.3545454 0.2487091 860 9.467066  0.0000
XvarFactor2    0.3909091 0.3517278   2 1.111397  0.3821

Number of Observations: 880
Number of Groups:
Plot1               Plot2 %in% Plot1
4                              8
Plot3 %in% Plot2 %in% Plot1
20

This is the correct result, de correct denDF for Xvar.

I make this using lmer.

> m.lmer <- lmer(Yvar~Xvar+(1|Plot1)+(1|Plot1:Plot2)+(1|Plot3))
> anova(m.lmer)
Analysis of Variance Table
Df Sum Sq Mean Sq  Denom F value Pr(>F)
Xvar  1  33.62   33.62 878.00  1.2352 0.2667
> summary(m.lmer)
Linear mixed-effects model fit by REML
Formula: Yvar ~ Xvar + (1 | Plot1) + (1 | Plot1:Plot2) + (1 | Plot3)
AIC     BIC    logLik MLdeviance REMLdeviance
5416.59 5445.27 -2702.295   5402.698      5404.59
Random effects:
Groups        Name        Variance   Std.Dev.
Plot3         (Intercept) 1.3608e-08 0.00011665
Plot1:Plot2   (Intercept) 1.3608e-08 0.00011665
Plot1         (Intercept) 1.3608e-08 0.00011665
Residual                  2.7217e+01 5.21695390
# of obs: 880, groups: Plot3, 20; Plot1:Plot2, 8; Plot1, 4

Fixed effects:
Estimate Std. Error  DF t value Pr(>|t|)
(Intercept)      2.35455    0.24871 878  9.4671   <2e-16 ***
XvarFactor2      0.39091    0.35173 878  1.1114   0.2667
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Look the wrong P value, I know that it is wrong because the DF used. But, In
this case, the result is not correct. Dont have any difference of the result
using random effects with lmer and using a simple analyses with lm.

> m.lm <- lm(Yvar~Xvar)
>
> anova(m.lm)
Analysis of Variance Table

Df  Sum Sq Mean Sq F value Pr(>F)
Xvar         1    33.6    33.6  1.2352 0.2667
Residuals  878 23896.2    27.2
>
> summary(m.lm)

Call:
lm(formula = Yvar ~ Xvar)

Residuals:
Min      1Q  Median      3Q     Max
-2.7455 -2.3545 -1.7455  0.2545 69.6455

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)      2.3545     0.2487   9.467   <2e-16 ***
XvarFactor2      0.3909     0.3517   1.111    0.267
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 5.217 on 878 degrees of freedom
Multiple R-Squared: 0.001405,	Adjusted R-squared: 0.0002675
F-statistic: 1.235 on 1 and 878 DF,  p-value: 0.2667

this use with a gaussian error, I undestand this with glm data.

Thanks
Ronaldo
--
|>   // | \\   [***********************************]
|   ( õ   õ )  [Ronaldo Reis Júnior                ]
|>      V      [UFV/DBA-Entomologia                ]
|    /     \   [36570-000 Viçosa - MG              ]
|>  /(.''`.)\  [Fone: 31-3899-4007                 ]
|  /(: :'  :)\ [chrysopa at insecta.ufv.br            ]
|>/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ]
|    ( `-  )   [***********************************]