首页 文章

线性混合效应模型中的重要相互作用,但图表显示重叠置信度间隔?

提问于
浏览
0

这是我第一次在stackoverflow上寻求帮助,所以请原谅我所犯的任何错误,如果需要进一步的信息,请发表评论 . 可悲的是,由于它们是保密的,我无法向您提供原始数据 . 我尽可能地向您展示数据的结构和我生成的结果 .

数据结构如下:

GroupID Person Factor2 Factor1 Rating
    <int>  <int>  <fctr>  <fctr>  <int>
1       2    109       2       0      1
2       2    109       2       1     -2
3       2    104       1       0      4
4       2    236       1       1      1
5       2    279       1       1      2
6       2    179       2       1      0

人是参与者ID,GroupID是刺激类别,因子1(0级和1级)和因子2(1级和2级)是固定因子,而评级是结果变量 .

我正在尝试在线性混合效果模型中打印一个显着交互的图 . 我使用包lme4和lmerTest来分析数据 .

这是我们运行的模型:

> model_interaction <- lmer(Rating ~ Factor1 * Factor2 + ( 1 | Person) +
(1 | GroupID), data)
> model_interaction

Linear mixed model fit by REML ['merModLmerTest']
Formula: Rating ~ Factor1 * Factor2 + (1 | Person) + (1 | GroupID)
Data: data
REML criterion at convergence: 207223.9

Random effects:
 Groups   Name        Std.Dev.
 Person   (Intercept) 1.036   
 GroupID  (Intercept) 1.786   
 Residual             1.880   
Number of obs: 50240, groups:  Person, 157; GroupID, 80
Fixed Effects:
  (Intercept)           Factor11           Factor22  Factor11:Factor22  
     -0.43823            0.01313            0.08568            0.12440

当我使用summary()函数时,R返回以下输出

> summary(model_interaction)

Linear mixed model fit by REML 
t-tests use  Satterthwaite approximations to degrees of freedom
['lmerMod']
Formula: Rating ~ Factor1 * Factor2 + (1 | Person) + (1 | GroupID)
   Data: data

REML criterion at convergence: 207223.9

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.8476 -0.6546 -0.0213  0.6516  4.2284 

Random effects:
 Groups   Name        Variance Std.Dev.
 Person   (Intercept) 1.074    1.036   
 GroupID  (Intercept) 3.191    1.786   
 Residual             3.533    1.880   
Number of obs: 50240, groups:  Person, 157; GroupID, 80

Fixed effects:
                    Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)       -4.382e-01  2.185e-01  1.110e+02  -2.006 0.047336 *  
Factor11           1.313e-02  2.332e-02  5.004e+04   0.563 0.573419    
Factor22           8.568e-02  6.275e-02  9.793e+03   1.365 0.172138    
Factor11:Factor22  1.244e-01  3.385e-02  5.002e+04   3.675 0.000238 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) Fctr11 Fctr22
Factor11    -0.047              
Factor22    -0.135  0.141       
Fctr11:Fc22  0.034 -0.694 -0.249

我知道不可能解释线性混合效应模型的p值 . 所以我运行了一个额外的anova,将交互模型与只有Factor1和Factor2的主要影响的模型进行比较

> model_Factor1_Factor2 = lmer(Rating ~ Factor1 + Factor2 +
  ( 1 | Person) + (1 | GroupID), data)
> anova(model_Factor1_Factor2, model_interaction)

Data: data
Models:
object: Rating ~ Factor1 + Factor2 + (1 | Person) + (1 | GroupID)
..1: Rating ~ Factor1 * Factor2 + (1 | Person) + (1 | GroupID)
       Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)    
object  6 207233 207286 -103611   207221                             
..1     7 207222 207283 -103604   207208 13.502      1  0.0002384 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

我将此输出解释为:因子1和因子2的相互作用解释了与仅具有因子1和因子2的主要作用的模型相比,我的结果测量中的额外变化 .

由于解释线性混合效应模型的输出很难,我想打印一个显示因子1和因子2相互作用的图表 . 我这样做是使用lsmeans包(首先我使用了plot(allEffects)但是在阅读了这个How to get coefficients and their confidence intervals in mixed effects models?问题后,我意识到这不是打印线性混合效果模型图形的正确方法) .

所以这就是我的所作所为(关注本网站http://rcompanion.org/handbook/G_06.html

> leastsquare = lsmeans(model_interaction, pairwise ~ Factor2:Factor1,
 adjust="bon")
> CLD = cld(leastsquare, alpha=0.05, Letters=letters, adjust="bon")
> CLD$.group=gsub(" ", "", CLD$.group)
> CLD
 Factor2 Factor1     lsmean        SE     df   lower.CL  upper.CL .group
 1       0       -0.4382331 0.2185106 111.05 -0.9930408 0.1165746  a    
 1       1       -0.4251015 0.2186664 111.36 -0.9803048 0.1301018  a    
 2       0       -0.3525561 0.2190264 112.09 -0.9086735 0.2035612  a    
 2       1       -0.2150234 0.2189592 111.95 -0.7709700 0.3409233   b   

Degrees-of-freedom method: satterthwaite 
Confidence level used: 0.95 
Conf-level adjustment: bonferroni method for 4 estimates 
P value adjustment: bonferroni method for 6 tests 
significance level used: alpha = 0.05

这是我使用的绘图功能

> ggplot(CLD, aes(`Factor1`, y = lsmean, ymax = upper.CL,
  ymin = lower.CL, colour = `Factor2`, group = `Factor2`)) +
  geom_pointrange(stat = "identity",
  position = position_dodge(width = 0.1)) +
  geom_line(position = position_dodge(width = 0.1))

该图可以使用此链接找到(我暂时不允许发布图片,请原谅解决方法)

Interaction of Factor1 and Factor2

现在我的问题如下:为什么我通过这种交互有一个重要的交互和大量解释的方差,但我的信心在情节重叠中插入?我想我的置信区间做错了吗?或者是因为它不可能解释线性混合效应模型的显着性指数?

1 回答

  • 0

    因为它是苹果和橘子 .

    苹果:手段的置信区间 .

    橘子:手段差异的测试 .

    均值和均值的差异是不同的统计数据,它们具有不同的标准误差和其他分布特性 . 特别是在混合模型中,它们可能完全不同,因为当您采取差异时,某些变异来源可能会抵消 .

    不要尝试使用置信区间进行比较 . 这就像试图用汉堡包制作鸡汤 .

相关问题