【问题标题】:R CLM Logistic regression Significance changes depending on order of input of independent variablesR CLM 逻辑回归 显着性变化取决于自变量的输入顺序
【发布时间】:2019-11-25 16:17:58
【问题描述】:

我运行分类逻辑回归。 Int 是智力排名(第 1 位、第 2 位、第 3 位和第 4 位)

我的问题:我发现,重要性取决于我如何定义 Sex 和 Pos(身体姿势)的级别,在 Sex 上设置第一个 M 或 F,在 Pos(姿势)上设置 Open 和 Closed。 这对我来说很奇怪,因为我认为,改变水平顺序只会改变 - 和 + 系数。我做错了什么?强大的 Pos*Sex 交互是解决问题的关键吗?

非常感谢您的每一个提示。

你可以在这里看到每个组合的输出:

> Pos = relevel(Pos,ref="Open")
> mopen<- clm(Int ~  Pos*Sex, data = x)
> summary(mopen)
formula: Int ~ Pos * Sex
data:    x

 link  threshold nobs logLik  AIC     niter max.grad cond.H 
 logit flexible  668  -904.76 1821.51 4(0)  1.30e-12 6.7e+01

Coefficients:
                Estimate Std. Error z value Pr(>|z|)    
PosClosed       1.128633   0.204955   5.507 3.66e-08 ***
SexF            0.008686   0.195416   0.044 0.964548    
PosClosed:SexF -0.991075   0.281194  -3.525 0.000424 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
1|2  -0.8356     0.1489  -5.614
2|3   0.2956     0.1451   2.037
3|4   1.4497     0.1557   9.310
> 
> Sex = relevel(Sex,ref="F")
> Pos = relevel(Pos,ref="Open")
> fopen<- clm(Int ~  Pos*Sex, data = x)
> summary(fopen)
formula: Int ~ Pos * Sex
data:    x

 link  threshold nobs logLik  AIC     niter max.grad cond.H 
 logit flexible  668  -904.76 1821.51 4(0)  1.27e-12 6.4e+01

Coefficients:
                Estimate Std. Error z value Pr(>|z|)    
PosClosed       0.137559   0.193101   0.712 0.476238    
SexM           -0.008686   0.195416  -0.044 0.964548    
PosClosed:SexM  0.991075   0.281194   3.525 0.000424 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
1|2  -0.8443     0.1458  -5.791
2|3   0.2869     0.1406   2.041
3|4   1.4410     0.1519   9.489
> 
> Sex = relevel(Sex,ref="M")
> Pos = relevel(Pos,ref="Closed")
> mclosed<- clm(Int ~  Pos*Sex, data = x)
> summary(mclosed)
formula: Int ~ Pos * Sex
data:    x

 link  threshold nobs logLik  AIC     niter max.grad cond.H 
 logit flexible  668  -904.76 1821.51 4(0)  1.30e-12 7.2e+01

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
PosOpen       -1.1286     0.2050  -5.507 3.66e-08 ***
SexF          -0.9824     0.2021  -4.861 1.17e-06 ***
PosOpen:SexF   0.9911     0.2812   3.525 0.000424 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
1|2  -1.9642     0.1656 -11.859
2|3  -0.8331     0.1536  -5.422
3|4   0.3211     0.1506   2.132
> 
> Sex = relevel(Sex,ref="F")
> Pos = relevel(Pos,ref="Closed")
> fclosed<- clm(Int ~  Pos*Sex, data = x)
> summary(fclosed)
formula: Int ~ Pos * Sex
data:    x

 link  threshold nobs logLik  AIC     niter max.grad cond.H 
 logit flexible  668  -904.76 1821.51 4(0)  1.32e-12 6.5e+01

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
PosOpen       -0.1376     0.1931  -0.712 0.476238    
SexM           0.9824     0.2021   4.861 1.17e-06 ***
PosOpen:SexM  -0.9911     0.2812  -3.525 0.000424 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
1|2  -0.9819     0.1477  -6.649
2|3   0.1493     0.1413   1.057
3|4   1.3035     0.1512   8.623

【问题讨论】:

    标签: r logistic-regression categorical-data interaction


    【解决方案1】:

    我的最佳答案是,对 f/m 和关闭/打开使用虚拟代码是错误的

    我尝试了一个对比代码,得到了更好的结果

    使用以下代码创建对比

    contrasts(Sex) <- contr.sum(2)
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-03
      • 2016-06-30
      • 2021-11-23
      • 2022-08-17
      • 2020-08-19
      • 1970-01-01
      • 2020-11-23
      • 1970-01-01
      相关资源
      最近更新 更多