risk_from_chf | R Documentation |
Some models do not come with a ready to use risk prediction. This function allows for its generation based on the cumulative hazard function.
risk_from_chf(predict_cumulative_hazard_function, times)
predict_cumulative_hazard_function |
a function of three arguments ( |
times |
a numeric vector of times at which the function should be evaluated. |
A function of two arguments (model
, newdata
) returning a vector of risks.
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.