Learn R Programming

mlr3proba (version 0.4.2)

.surv_return: Get Survival Predict Types

Description

Internal helper function to easily return the correct survival predict types and to automatically coerce a predicted survival probability matrix to a distr6::VectorDistribution of distr6::WeightedDiscrete distributions.

Usage

.surv_return(
  times = NULL,
  surv = NULL,
  crank = NULL,
  lp = NULL,
  response = NULL
)

Arguments

times

(numeric()) Vector of survival times.

surv

(matrix()) Matrix of predicted survival probabilities, rows are observations, columns are times. Number of columns should be equal to length of times.

crank

(numeric()) Relative risk/continuous ranking. Higher value is associated with higher risk. If NULL then either set as lp if available or as the estimated survival expectation, computed by colSums(surv).

lp

(numeric()) Predicted linear predictor, used to impute crank if NULL.

response

(numeric()) Predicted survival time, passed through function without modification.

Details

To avoid complications caused by degenerative distributions, if 0 is not in times, then this is added as the first time-point and a column of 1s is bound to the left of surv. Additionally if the final column of surv is not all 1s, then an additional time is added as max(times) + 1e-3 and a column of 1s is bound to the right of surv.