重新调整预测变量可以更改更清晰的结果

时间:2019-03-27 10:33:13

标签: statistics logistic-regression

我需要帮助,使用lme4中的glmer()来了解同一模型的两个输出之间的差异。

数据来自语言处理实验,该实验研究了三个分类变量(控制/ copula /性别)对二项式响应(优选或不推荐)的影响。每个实验因素/预测因素都有两个级别:对照(受试者/对象),copula(ser / estar)性别(男性/女性)。每个项目的响应总数略有不同,因为必须丢弃其中一些。

这是数据的样子:

> head(data2)
   participant list item presentation type control control_verb copula gender response preferences preferences_narrow    rt  adjective
2            1    1    1            2    a subject     prometer    ser   masc masc_adj   preferred          preferred 32.91  Ordenado 
3            1    1   10            3    b subject     declarar  estar   masc masc_adj   preferred          preferred 18.07 Arruinado 
5            1    1   21            5    b  object       mandar  estar    fem  fem_adj   preferred          preferred 15.25   Callada 
8            1    1    8            8    d subject   manifestar  estar    fem  fem_adj   preferred          preferred 15.55   Cansada 
9            1    1    9            9    a subject   garantizar    ser   masc masc_adj   preferred          preferred 63.59  Ordenado 
11           1    1   25           11    b  object     prohibir  estar    fem  fem_adj   preferred          preferred 40.06    Sentada

我运行此模型

`model1= glmer(preferences~control*copula*gender+(1|participant) +(1|item), family=binomial, data`=data2)

这是当R按字母顺序获取响应/预测变量时的输出:

  Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: preferences_narrow ~ control * copula * gender + (1 | participant) +      (1 | item)
   Data: data2

     AIC      BIC   logLik deviance df.resid 
  1126.6   1184.9   -553.3   1106.6     2515 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-8.6537  0.1519  0.2031  0.2696  1.1485 

Random effects:
 Groups      Name        Variance Std.Dev.
 participant (Intercept) 0.3371   0.5806  
 item        (Intercept) 0.5004   0.7074  
Number of obs: 2525, groups:  participant, 105; item, 28

Fixed effects:
                                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)                          3.11880    0.32552   9.581  < 2e-16 ***
controlsubject                       0.11594    0.44584   0.260 0.794832    
copulaser                            0.09089    0.35782   0.254 0.799495    
gendermasc                          -0.82386    0.30586  -2.694 0.007069 ** 
controlsubject:copulaser            -0.77092    0.48415  -1.592 0.111311    
controlsubject:gendermasc            0.93221    0.47276   1.972 0.048629 *  
copulaser:gendermasc                 2.14234    0.61348   3.492 0.000479 ***
controlsubject:copulaser:gendermasc -1.72999    0.78585  -2.201 0.027706 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
             (Intr) cntrls coplsr gndrms cntrlsbjct:c cntrlsbjct:g cplsr:
contrlsbjct  -0.672                                                      
copulaser    -0.497  0.370                                               
gendermasc   -0.605  0.441  0.540                                        
cntrlsbjct:c  0.361 -0.563 -0.743 -0.402                                 
cntrlsbjct:g  0.387 -0.579 -0.352 -0.646  0.533                          
cplsr:gndrm   0.307 -0.225 -0.586 -0.500  0.436        0.326             
cntrlsbjc::  -0.235  0.355  0.463  0.393 -0.621       -0.608       -0.785

但是,当我重新调整(例如)响应变量时,如下所示:

data2$preferences_narrow = relevel(data2$preferences_narrow, ref="preferred")

现在模型无法收敛:

 Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.00211263 (tol = 0.001, component 1)
> summary(model1)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: preferences_narrow ~ control * copula * gender + (1 | participant) +      (1 | item)
   Data: data2

     AIC      BIC   logLik deviance df.resid 
  1126.6   1184.9   -553.3   1106.6     2515 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.1486 -0.2695 -0.2031 -0.1519  8.6561 

Random effects:
 Groups      Name        Variance Std.Dev.
 participant (Intercept) 0.3371   0.5806  
 item        (Intercept) 0.5005   0.7075  
Number of obs: 2525, groups:  participant, 105; item, 28

Fixed effects:
                                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)                         -3.11967    0.32560  -9.581  < 2e-16 ***
controlsubject                      -0.11504    0.44591  -0.258 0.796421    
copulaser                           -0.08988    0.35784  -0.251 0.801673    
gendermasc                           0.82460    0.30591   2.696 0.007027 ** 
controlsubject:copulaser             0.76970    0.48418   1.590 0.111900    
controlsubject:gendermasc           -0.93321    0.47282  -1.974 0.048414 *  
copulaser:gendermasc                -2.14404    0.61360  -3.494 0.000476 ***
controlsubject:copulaser:gendermasc  1.73218    0.78598   2.204 0.027535 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
             (Intr) cntrls coplsr gndrms cntrlsbjct:c cntrlsbjct:g cplsr:
contrlsbjct  -0.672                                                      
copulaser    -0.497  0.370                                               
gendermasc   -0.606  0.441  0.540                                        
cntrlsbjct:c  0.361 -0.563 -0.743 -0.402                                 
cntrlsbjct:g  0.387 -0.579 -0.353 -0.646  0.533                          
cplsr:gndrm   0.307 -0.225 -0.586 -0.500  0.436        0.326             
cntrlsbjc::  -0.236  0.355  0.463  0.393 -0.621       -0.608       -0.785
convergence code: 0
Model failed to converge with max|grad| = 0.00211263 (tol = 0.001, component 1)

我不了解这种行为...如果我重新调整其他变量的大小,结果将发生很大变化。

此外,我可以解释在存在交互作用时控制的主要作用吗?我如何跟进模型的交互作用以调查它们的来源?

我尝试过:

#Follow up control*gender
emmeans(model1, list(pairwise ~ control*gender), adjust = "bonf")

#Follow up copula*gender
emmeans(model1, list(pairwise ~ copula*gender), adjust = "bonf")

#Follow up control*copula*gender
emmeans(model1, list(pairwise ~ control*copula*gender), adjust = "bonf")

谢谢:)

0 个答案:

没有答案