首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SAS混合vs lmerTest输出

SAS混合vs lmerTest输出
EN

Stack Overflow用户
提问于 2017-01-20 17:58:22
回答 1查看 814关注 0票数 2

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

这是我的数据:

代码语言:javascript
复制
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中使用以下语句:

代码语言:javascript
复制
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混合过程完全相同。

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

非常感谢!

巴特

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-20 18:10:33

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

代码语言:javascript
复制
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
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41760744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档