混合モデルがあり、データは次のようになります。
> head(pce.ddply)
subject Condition errorType errors
1 j202 G O 0.00000000
2 j202 G P 0.00000000
3 j203 G O 0.08333333
4 j203 G P 0.00000000
5 j205 G O 0.16666667
6 j205 G P 0.00000000
各被験者は errorType (O または P) に 2 つのデータポイントを提供し、各被験者は状態 G (N=30) または N (N=33) のいずれかに属します。errorType は反復変数で、Condition は中間変数です。主効果と相互作用の両方に興味があります。したがって、最初に anova を実行します。
> summary(aov(errors ~ Condition * errorType + Error(subject/(errorType)),
data = pce.ddply))
Error: subject
Df Sum Sq Mean Sq F value Pr(>F)
Condition 1 0.00507 0.005065 2.465 0.122
Residuals 61 0.12534 0.002055
Error: subject:errorType
Df Sum Sq Mean Sq F value Pr(>F)
errorType 1 0.03199 0.03199 10.52 0.001919 **
Condition:errorType 1 0.04010 0.04010 13.19 0.000579 ***
Residuals 61 0.18552 0.00304
Condition は重要ではありませんが、errorType はインタラクションと同様に重要です。
ただし、lmer を使用すると、まったく異なる結果が得られます。
> lmer(errors ~ Condition * errorType + (1 | subject),
data = pce.ddply)
Linear mixed model fit by REML
Formula: errors ~ Condition * errorType + (1 | subject)
Data: pce.ddply
AIC BIC logLik deviance REMLdev
-356.6 -339.6 184.3 -399 -368.6
Random effects:
Groups Name Variance Std.Dev.
subject (Intercept) 0.000000 0.000000
Residual 0.002548 0.050477
Number of obs: 126, groups: subject, 63
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.028030 0.009216 3.042
ConditionN 0.048416 0.012734 3.802
errorTypeP 0.005556 0.013033 0.426
ConditionN:errorTypeP -0.071442 0.018008 -3.967
Correlation of Fixed Effects:
(Intr) CndtnN errrTP
ConditionN -0.724
errorTypeP -0.707 0.512
CndtnN:rrTP 0.512 -0.707 -0.724
そのため、lmer の場合、Condition と相互作用は重要ですが、errorType はそうではありません。
また、lmer の結果は glm の結果とまったく同じであり、何かがおかしいと思います。
誰かがなぜ彼らがそんなに違うのか理解するのを手伝ってもらえますか? lmer を間違って使用していると思われます ((errorType | subject) のような他の多くのバージョンを試してみましたが、同様の結果が得られました。