【发布时间】:2015-04-26 16:36:39
【问题描述】:
我正在使用不同的包做 ogit,它们是 VGAM、rms、MASS 和 ordinal,使用来自包 wine 的数据集 ordinal。
首先是vglm():
library(VGAM)
vglmfit <- vglm(rating ~ temp * contact, data = wine,
family=cumulative(parallel=TRUE, reverse=TRUE))
系数是:
(Intercept):1 (Intercept):2 (Intercept):3 (Intercept):4
1.4112568 -1.1435551 -3.3770742 -4.9419773
tempwarm contactyes tempwarm:contactyes
2.3212033 1.3474598 0.3595241
第二个是orm():
library(rms)
ormfit <- orm(rating ~ temp * contact, data = wine)
系数:
Coef S.E. Wald Z Pr(>|Z|)
y>=2 1.4113 0.5454 2.59 0.0097
y>=3 -1.1436 0.5097 -2.24 0.0248
y>=4 -3.3771 0.6382 -5.29 <0.0001
y>=5 -4.9420 0.7509 -6.58 <0.0001
temp=warm 2.3212 0.7009 3.31 0.0009
contact=yes 1.3475 0.6604 2.04 0.0413
temp=warm * contact=yes 0.3595 0.9238 0.39 0.6971
第三,polr:
library(MASS)
polrfit <- polr(rating ~ temp * contact, method="logistic", data = wine)
系数:
Coefficients:
tempwarm contactyes tempwarm:contactyes
2.3211214 1.3474055 0.3596357
Intercepts:
1|2 2|3 3|4 4|5
-1.411278 1.143507 3.377005 4.941901
最后,clm():
library(ordinal)
clmfit <- clm(rating ~ temp * contact, link="logit", data = wine)
系数:
Coefficients:
tempwarm contactyes tempwarm:contactyes
2.3212 1.3475 0.3595
Threshold coefficients:
1|2 2|3 3|4 4|5
-1.411 1.144 3.377 4.942
另外,当reverse=FALSE在vglm()中时,
library(VGAM)
vglmfit <- vglm(rating ~ temp * contact, data = wine,
family=cumulative(parallel=TRUE, reverse=FALSE))
Coefficients:
(Intercept):1 (Intercept):2 (Intercept):3 (Intercept):4
-1.4112568 1.1435551 3.3770742 4.9419773
tempwarm contactyes tempwarm:contactyes
-2.3212033 -1.3474598 -0.3595241
您可能会注意到vglm() 和reverse=TRUE 中的系数与orm() 中的系数相同,polr() 和clm() 中的系数相同。所以有两组系数,唯一的区别是截距的符号。
虽然我设置了reverse=FALSE,但它确实反转了截距,但同时反转了我不想要的变量参数。
这有什么问题?我怎么能得到完全相同的结果?或者我该如何解释?
【问题讨论】:
标签: r