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.
.surv_return(
times = NULL,
surv = NULL,
crank = NULL,
lp = NULL,
response = NULL
)
(numeric()
) Vector of survival times.
(matrix()
) Matrix of predicted survival probabilities, rows are observations,
columns are times. Number of columns should be equal to length of times
.
(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)
.
(numeric()
) Predicted linear predictor, used to impute crank
if NULL
.
(numeric()
) Predicted survival time, passed through function without
modification.
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 1
s is bound to the left of surv
.
Additionally if the final column of surv
is not all 1
s, then an additional time is added
as max(times) + 1e-3
and a column of 1
s is bound to the right of surv
.