I am using rms
and can't understand the difference between orm
and lrm
when used with contrasts
. For example:
x <- factor(rbinom(100,2,0.6), labels = c("a","b","c"), ordered = TRUE)
y <- factor(rbinom(100,1,0.5), labels=c("no","yes"))
l <- lrm(x~y)
l
Logistic Regression Model
lrm(formula = x ~ y)
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 100 LR chi2 0.51 R2 0.006 C 0.529
a 24 d.f. 1 g 0.133 Dxy 0.059
b 40 Pr(> chi2) 0.4764 gr 1.143 gamma 0.117
c 36 gp 0.024 tau-a 0.039
max |deriv| 1e-10 Brier 0.181
Coef S.E. Wald Z Pr(>|Z|)
y>=b 1.0188 0.2988 3.41 0.0007
y>=c -0.7162 0.2884 -2.48 0.0130
y=yes 0.2642 0.3715 0.71 0.4769
o <- orm(x~y)
l;o
Logistic (Proportional Odds) Ordinal Regression Model
orm(formula = x ~ y)
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 100 LR chi2 0.51 R2 0.006 rho 0.071
a 24 d.f. 1 g 0.133
b 40 Pr(> chi2) 0.4764 gr 1.143
c 36 Score chi2 0.51 |Pr(Y>=median)-0.5| 0.259
Unique Y 3 Pr(> chi2) 0.4766
Median Y 2
max |deriv| 7e-05
Coef S.E. Wald Z Pr(>|Z|)
y>=b 1.0188 0.2988 3.41 0.0007
y>=c -0.7162 0.2884 -2.48 0.0130
y=yes 0.2642 0.3715 0.71 0.4769
We can see, that results of orm
and lrm
are equal. But when we use contrasts
the results are different:
contrast(l,list(y="no"),list(y="yes"))
Contrast S.E. Lower Upper Z Pr(>|z|)
11 -0.2642454 0.3714673 -0.9923081 0.4638172 -0.71 0.4769
Confidence intervals are 0.95 individual intervals
and
contrast(o,list(y="no"),list(y="yes"))
Contrast S.E. Lower Upper Z Pr(>|z|)
11 0.7545878 0.3714672 0.02652544 1.48265 2.03 0.0422
Confidence intervals are 0.95 individual intervals
Why orm
contrast aren't equal beta regression coefficient as lrm
contrast?
Best Answer
This is a significant error that has now been fixed on github and will be in the next release to CRAN. It's best to report
rms
package issues through https://github.com/harrelfe/rms. But thanks for reporting the error. You can get a temporary fix by typing