risk_from_chf {survex} | R Documentation |
Generate Risk Prediction based on the Survival Function
Description
Some models do not come with a ready to use risk prediction. This function allows for its generation based on the cumulative hazard function.
Usage
risk_from_chf(predict_cumulative_hazard_function, times)
Arguments
predict_cumulative_hazard_function |
a function of three arguments ( |
times |
a numeric vector of times at which the function should be evaluated. |
Value
A function of two arguments (model
, newdata
) returning a vector of risks.
Examples
library(survex)
library(survival)
rsf_src <- randomForestSRC::rfsrc(Surv(time, status) ~ ., data = veteran)
chf_function <- transform_to_stepfunction(predict,
type = "chf",
prediction_element = "chf",
times_element = "time.interest"
)
risk_function <- risk_from_chf(chf_function, unique(veteran$time))
explainer <- explain(rsf_src,
predict_cumulative_hazard_function = chf_function,
predict_function = risk_function
)
[Package survex version 1.2.0 Index]