I would like to compute concordance index to validate Cox model. From the following post concordance rms I know that I can use
rms package and
rcorr.cens function. My concern is that Concordance index reported by
rms is different from the one reported by the summary of
coxph model from
survival package. Here is my example:
library('survival') library('rms') data('vetera') validation_obj <- Surv(time = veteran$time, event = veteran$status) m.coxph <-coxph(Surv(time, status) ~ celltype+prior, data =veteran) summary(m.coxph)$concordance forecast <- predict(m.coxph,veteran[,c('celltype', 'prior')] ) rcorr.cens(x=forecast, S=validation_obj)
summary(m.coxph)$concordance returns 0.61330077
rcorr.cens(x=forecast, S=validation_obj) returns 3.866992e-01
Does anybody know reason for discrepancy?
I just noticed that two concordance indices add up to 1, and it does not look like coincidence.
So it looks like the above computations are somewhat meaningless:
forecast <- predict(m.coxph,veteran[,c('celltype', 'prior')] ) returns linear combination of coefficients and independent variables. So prediction is a part of hazard function, while
S=validation_obj is survival object. Survival and hazard have opposite directions, so in order for code to work one needs to multiply hazard by
-1. Here is corrected line: