plot.surv_variable_response_explainer: Plot for surv_variable_response object

View source: R/plot_variable_response.R

plot.surv_variable_response_explainerR Documentation

Plot for surv_variable_response object

Description

Function plot for surv_variable_response object shows the expected output condition on a selected variable.

Usage

## S3 method for class 'surv_variable_response_explainer'
plot(x, ..., split = "model")

Arguments

x

an object of class "surv_variable_response"

...

optional, additional objects of class "surv_variable_response_explainer"

split

a character, either "model" or "variable"; sets the variable for faceting

Examples


library(survxai)
library(rms)
data("pbcTest")
data("pbcTrain")
predict_times <- function(model, data, times){
                  prob <- rms::survest(model, data, times = times)$surv
                  return(prob)
                  }
cph_model <- cph(Surv(years, status)~sex + bili + stage, data=pbcTrain, surv=TRUE, x = TRUE, y=TRUE)
surve_cph <- explain(model = cph_model, data = pbcTest[,-c(1,5)],
             y = Surv(pbcTest$years, pbcTest$status), predict_function = predict_times)
svr_cph <- variable_response(surve_cph, "sex")
plot(svr_cph)



MI2DataLab/survxai documentation built on Sept. 10, 2022, 12:03 a.m.