以下2个模型真的一样吗?
> library(lme4)
> library(lmerTest)
> lmod = lmer(Reaction ~ Days + (Days|Subject), data=sleepstudy)
> summary(lmod)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['merModLmerTest']
Formula: Reaction ~ Days + (Days | Subject)
Data: sleepstudy
REML criterion at convergence: 1743.6
Scaled residuals:
Min 1Q Median 3Q Max
-3.9536 -0.4634 0.0231 0.4634 5.1793
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 612.09 24.740
Days 35.07 5.922 0.07
Residual 654.94 25.592
Number of obs: 180, groups: Subject, 18
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 251.405 6.825 17.000 36.838 < 0.0000000000000002 ***
Days 10.467 1.546 17.000 6.771 0.00000326 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr)
Days -0.138
和:
> laov = aov(Reaction ~ Days + Error(Subject/Days), data=sleepstudy)
> summary(laov)
Error: Subject
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 17 250618 14742
Error: Subject:Days
Df Sum Sq Mean Sq F value Pr(>F)
Days 1 162703 162703 45.85 0.00000326 ***
Residuals 17 60322 3548
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 144 94312 654.9
两者都显示了 Days 变量的相似 P 值。两种方法有什么区别?