R CLM Logistic回归显着性取决于自变量输入的顺序

问题描述 投票:0回答:1

我进行了分类逻辑回归。Int是智力排名(第一名,第二名,第三名和第四名)

[我的问题:我发现,重要性的变化取决于我如何定义性别和姿势(身体姿势)的级别,在性上设置第一个M或F以及在姿势上打开和关闭(姿势)。这对我来说很奇怪,因为我认为改变电平顺序只会改变系数的-和+。我怎么了强大的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个回答
0
投票

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

我尝试了对比代码并获得了更好的结果

使用以下代码创建对比度

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

© www.soinside.com 2019 - 2024. All rights reserved.