model_diagnostics {survex} | R Documentation |
Dataset Level Model Diagnostics
Description
This function calculates martingale and deviance residuals.
Usage
model_diagnostics(explainer)
## S3 method for class 'surv_explainer'
model_diagnostics(explainer)
Arguments
explainer |
an explainer object - model preprocessed by the |
Value
An object of class c("model_diagnostics_survival")
. It's a list with the explanations in the result
element.
Examples
library(survival)
library(survex)
cph <- coxph(Surv(time, status) ~ ., data = veteran, model = TRUE, x = TRUE, y = TRUE)
rsf_ranger <- ranger::ranger(Surv(time, status) ~ .,
data = veteran,
respect.unordered.factors = TRUE,
num.trees = 100,
mtry = 3,
max.depth = 5
)
cph_exp <- explain(cph)
rsf_ranger_exp <- explain(rsf_ranger,
data = veteran[, -c(3, 4)],
y = Surv(veteran$time, veteran$status)
)
cph_residuals <- model_diagnostics(cph_exp)
rsf_residuals <- model_diagnostics(rsf_ranger_exp)
head(cph_residuals$result)
plot(cph_residuals, rsf_residuals, xvariable = "age")
plot(cph_residuals, rsf_residuals, plot_type = "Cox-Snell")
[Package survex version 1.2.0 Index]