【问题标题】:Confidence intervals of 2-way and 3-way interactions using emmeans使用 emmeans 的 2-way 和 3-way 交互的置信区间
【发布时间】:2020-05-01 04:07:23
【问题描述】:

这只是一个关于在 emmeans 中获取交互置信区间的一般问题,我已经阅读了所有常见的教程,但我不明白如何为 2-way 和 3-way 交互做这件事。下面是一个 3 向交互的示例。

X= continous variable   
A= 3 levels, nested in L  
L= 2 levels  
G= 2 levels, crossed with L (and thus also A)  
ID= participants nested in G

然后我用随机截距拟合了一个线性混合模型:

fit1 <- lmer(X~G*A*L+(1|ID),data=df)
emms=emmeans(fit1,specs=pairwise~A*L*G)

我想要的比较完美地显示了:

contrast(emms,interaction="pairwise")$emmeans

但是,它们缺少置信区间,请注意运行:

summary(contrast(emms,interaction="pairwise")$emmeans,infere=T) or
confint(contrast(emms,interaction="pairwise")$emmeans) 

在 emmeans 数据上不起作用,它只是为不同级别的 emmeans 提供置信区间,而不是对比。这些函数适用于对比数据,但不显示三向交互。

更新:答案 我终于想通了:

confint(contrast(emmeans(fit1,~A*G*L),interaction=c("pairwise")))

【问题讨论】:

    标签: r emmeans


    【解决方案1】:

    其他答案产生的交互对比可能是您想要的,但它们包含 3-way 模型中对比的对比。当存在交互时,人们通常想要的是简单的比较——比较一个因素,而其他因素保持不变。这些可以通过

    获得
    pairs(emms[[1]], simple = “each”)
    

    【讨论】:

      【解决方案2】:
      confint(contrast(emmeans(fit1,~A*G*L),interaction=c("pairwise")))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-22
        • 1970-01-01
        • 1970-01-01
        • 2011-10-21
        • 2015-07-24
        相关资源
        最近更新 更多