SAS PROC MIXED 与 lmerTest 输出

Bar*_*art 2 r sas lme4 mixed-models

我正在尝试使用 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
Run Code Online (Sandbox Code Playgroud)

在 SAS 中使用以下语句:

proc mixed data=mbd;
        class participant;
        model data = condition / solution ddfm=sat;
        random intercept condition / sub=participant;
        run;
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

在此输入图像描述

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

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

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

多谢!

巴特

Rol*_*and 6

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

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