Skip to contents

Internal helper function to easily return the correct survival predict types.


  times = NULL,
  surv = NULL,
  crank = NULL,
  lp = NULL,
  response = NULL,
  which.curve = NULL



Vector of survival times.


Matrix or array of predicted survival probabilities, rows (1st dimension) are observations, columns (2nd dimension) are times and in the case of an array there should be one more dimension. Number of columns should be equal to length of times. In case a numeric() vector is provided, it is converted to a single row (one observation) matrix.


Relative risk/continuous ranking. Higher value is associated with higher risk. If NULL then either set as -response if available or lp if available (this assumes that the lp prediction comes from a PH type model - in case of an AFT model the user should provide -lp). In case neither response or lp are provided, then crank is calculated as the sum of the cumulative hazard function (expected mortality) derived from the predicted survival function (surv). In case surv is a 3d array, we use the which.curve parameter to decide which survival matrix (index in the 3rd dimension) will be chosen for the calculation of crank.


Predicted linear predictor, used to impute crank if NULL.


Predicted survival time, passed through function without modification.


Which curve (3rd dimension) should the crank be calculated for, in case surv is an array? If between (0,1) it is taken as the quantile of the curves otherwise if greater than 1 it is taken as the curve index. It can also be 'mean' and the survival probabilities are averaged across the 3rd dimension. Default value (NULL) is the 0.5 quantile which is the median across the 3rd dimension of the survival array.


Uses survivalmodels::surv_to_risk to reduce survival matrices to relative risks / rankings if crank is NULL.


Sonabend, R., Bender, A., & Vollmer, S. (2022). Avoiding C-hacking when evaluating survival distribution predictions with discrimination measures. Bioinformatics.