[R] Difference between R and SAS in Corcordance index in ordinal logistic regression

Frank Harrell f.harrell at vanderbilt.edu
Thu Jan 24 14:28:13 CET 2013

```lrm does some binning to make the calculations faster.  The exact calculation
is obtained by running

f <- lrm(...)
rcorr.cens(predict(f), DA), which results in:

C Index            Dxy           S.D.              n        missing
0.96814404     0.93628809     0.03808336    32.00000000     0.00000000
uncensored Relevant Pairs     Concordant      Uncertain
32.00000000   722.00000000   699.00000000     0.00000000

I.e., C=.968 instead of .963.  But this is even farther away than the value
from SAS you reported.

If you don't believe the rcorr.cens result, create a tiny example and do the
calculations by hand.
Frank

blackscorpio81 wrote
> Dear R users,
>
>  I am currently using Frank Harrell Jr package "rms" to model ordinal
> logistic regression with proportional odds. In order to assess model
> predictive ability, C concordance index is displayed and equals to 0.963.
>
> This is the code I used with the data attached
> data.csv <http://r.789695.n4.nabble.com/file/n4656409/data.csv>
>  :
>
>>require(rms)
>>a<-read.csv2("/data.csv",row.names = 1,na.strings = c(""," "),dec=".")
>>lrm(DA~SJ+TJ,data=a)
>
> Logistic Regression Model
>
> lrm(formula = DA~SJ+TJ, data = a)
>
> Frequencies of Responses
>
>  1  2  3  4
>  6 13  9  4
>
>                                               Model Likelihood
> Discrimination                  Rank Discrim.
>                                              Ratio Test
> Indexes                               Indexes
> Obs            32                      LR chi2      53.14             R2
> 0.875                      C       0.963
> max |deriv| 6e-06             d.f.             2                    g
> 8.690                Dxy     0.925
>                                              Pr(> chi2) <0.0001         gr
> 5942.469                    gamma   0.960
>
> gp       0.486                      tau-a   0.673
>
> Brier    0.022
>
>                         Coef              S.E.        Wald  Z     Pr(>|Z|)
> y>=2             -0.6161     0.6715        -0.92           0.3589
> y>=3             -6.5949     2.3750        -2.78          0.0055
> y>=4        -16.2358        5.3737         -3.02         0.0025
> SJ                 1.4341      0.5180          2.77         0.0056
> TJ                  0.5312      0.2483         2.14          0.0324
>
> I wanted to compare the results with SAS. I found the same slopes and
> intercept with opposite signs, which is normal since R models the
> probabilities P(Y>=k|X) whereas SAS models the probabilities P(Y<=k|X)
> (see pdf attached, page 2 , table "Association des probabilités prédites
> et des réponses observées").
> SAS_Report_-_Logistic_Regression.pdf
> <http://r.789695.n4.nabble.com/file/n4656409/SAS_Report_-_Logistic_Regression.pdf>
>
> I chose the order for levels.
>
> I controlled that the corresponding probabilities P(Y=k|X)  are the same
> with both softwares. But I can't understand why in SAS the C index drops
> from 0.963 down to 0.332.
>
> use slightly different technique to compute the C index ; it is
> nevertheless surprising to me to observe such a shift in the results.
>
> Does anyone have a clue on this ?
> Thank you very much for you help
> Blackscorpio

-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/Difference-between-R-and-SAS-in-Corcordance-index-in-ordinal-logistic-regression-tp4656409p4656508.html
Sent from the R help mailing list archive at Nabble.com.

```