I'm fitting a random survival forest in R using the ranger package, and I'm curious about how the OOB error rate is calculated. According to the documentation it is calculated as one minus Harrell's C-index. However, calculating the C-index requires two components: the actual survival times, and the predicted survival times (or at the very least a rank-ordering of my observations by expected survival time).

I have the actual survival times. But how do I get the predicted survival times, or a rank-ordering of my observations by expected survival time? The random forest itself returns estimated hazard and survival functions. My first thought was to turn each estimated survival function into a pmf of survival time, and calculate the expected survival time from that. However in practice this seems intractable, at least without making non-trivial assumptions, because the survival functions are usually truncated (e.g. cumulative probability of survival never hits 0 but instead is cut off around 0.2 or some other non-trivial probability).

Is there some other way of comparing (truncated) survival or hazard functions to create a ranking of estimated survival times?

Admittedly my question is essentially the same as this one but I don't think there is an adequate response there either.

  • $\begingroup$ See subsection 5.2 of the original RSF paper: Ishwaran, Hemant; Kogalur, Udaya B.; Blackstone, Eugene H.; Lauer, Michael S. Random survival forests. Ann. Appl. Stat. 2 (2008), no. 3, 841--860. doi:10.1214/08-AOAS169. projecteuclid.org/euclid.aoas/1223908043 $\endgroup$ May 8, 2020 at 14:48

2 Answers 2


I believe I found the answer I'm looking for here (equation 5, under Prediction Error).

The statistic used to compare outcomes is $\mathcal{M}_i=\sum_{k=1}^{M}\hat{H_e}(t_k|X_i)$ where $t_1,...,t_M$ are the unique times in the data, $\hat{H_e}$ is the cumulative hazard estimate, and $X_i$ is the vector of covariates for observation $i$.


You need observed survival time, observed event status and the predictor from the model. See https://arxiv.org/pdf/1507.03092.pdf.

Calculating Harrell's C is not model specific. Using R code:


#generate observed survival
  censor <- rbinom(100, 1, 0.33)
  time <- rpois(100, 100)

#place in survival object
  obs_surv <- Surv(time, censor)

#generate a predictor from model of any kind
  predictor <- rnorm(100, 100,25)

#assess value of predictor on observed data
  rcorr.cens(predictor, obs_surv)

C Index = 0.6004452

  • $\begingroup$ Yes, but how do I obtain the predictor from the model? The random forest returns estimated survival and hazard functions, not any particular statistic $\eta$ that can be plugged into the formula for Harrell's C (as far as I'm aware). Thanks. $\endgroup$ May 19, 2018 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.