SAS PROC MIXED 与 lmerTest 输出

SAS PROC MIXED vs lmerTest output

我正在尝试使用 R 中的 lmerTest 包在 SAS 中使用 Satterwaithe 近似来重现 PROC MIXED 过程的输出。

这是我的数据:

Participant Condition   Data
1   0   -1,032941629
1   0   0,869267841
1   0   -1,636722191
1   0   -1,15451393
1   0   0,340454836
1   0   -0,399315906
1   1   0,668983169
1   1   1,937817592
1   1   3,110013393
1   1   3,23409718
2   0   0,806881925
2   1   2,71020911
2   1   3,406864275
2   1   1,494288182
2   1   0,741827047
2   1   2,532062685
2   1   3,702118917
2   1   1,825046681
2   1   4,37167021
2   1   1,85125279
3   0   0,288743786
3   0   1,024396121
3   1   2,051281876
3   1   0,24543851
3   1   3,349677964
3   1   1,565395822
3   1   3,077031712
3   1   1,087494708
3   1   1,546150033
3   1   0,440249347

在 SAS 中使用以下语句:

proc mixed data=mbd;
        class participant;
        model data = condition / solution ddfm=sat;
        random intercept condition / sub=participant;
        run;

我得到这个输出:

我的问题是我似乎无法在 R 中使用 lmerTest 重现这些结果。

我认为 lmer(Data ~ Condition + (1 | Participant) + (Condition | Participant), REML=TRUE) 是我在 SAS 中所做的等效语句,但这给出了不同的结果。请注意,自由度与 SAS 输出相差甚远,因此我认为我正在估计 R 中的参数,而我没有在 SAS 中估计。我在 R 中尝试了其他几个语句,但未能获得完全相同的输出。然而,这应该是可能的,因为 lmerTest 包中的 lmer() 函数也使用 Satterwaithe 近似,并且应该与 SAS PROC MIXED 过程完全相同。

有人知道我在 R 中做错了什么吗?

非常感谢!

巴特

您没有指定与 SAS 示例中相同的随机效应。 (Condition | Participant) 在内部扩展为 (1 + Condition | Participant),它适合随机截距、随机斜率和它们之间的协方差 [1]。因此,您的模型中有两个附加参数(截距方差和协方差)。可以使用 lme4 语法中的 || 指定不相关的随机效应。请注意公式如何在摘要输出中展开。

library(lmerTest)
fit <- lmer(Data ~ Condition + (Condition || Participant), REML=TRUE, data = DF)
summary(fit)
#Linear mixed model fit by REML 
#t-tests use  Satterthwaite approximations to degrees of freedom ['lmerMod']
#Formula: Data ~ Condition + ((1 | Participant) + (0 + Condition | Participant))
#   Data: DF
#
#REML criterion at convergence: 90.6
#
#Scaled residuals: 
#     Min       1Q   Median       3Q      Max 
#-1.58383 -0.78970 -0.06993  0.87801  1.91237 
#
#Random effects:
# Groups        Name        Variance Std.Dev.
# Participant   (Intercept) 0.00000  0.000   
# Participant.1 Condition   0.07292  0.270   
# Residual                  1.20701  1.099   
#Number of obs: 30, groups:  Participant, 3
#
#Fixed effects:
#            Estimate Std. Error       df t value Pr(>|t|)    
#(Intercept) -0.09931    0.36621 26.50400  -0.271 0.788363    
#Condition    2.23711    0.46655 12.05700   4.795 0.000432 ***
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#Correlation of Fixed Effects:
#          (Intr)
#Condition -0.785