plot.surv_prediction_breakdown_explainer: Plot for surv_breakdown object

View source: R/plot_prediction_breakdown.R

plot.surv_prediction_breakdown_explainerR Documentation

Plot for surv_breakdown object

Description

Function plot for surv_breakdown object visualise estimated survival curve of mean probabilities in chosen time points.

Usage

## S3 method for class 'surv_prediction_breakdown_explainer'
plot(
  x,
  ...,
  numerate = TRUE,
  lines = TRUE,
  lines_type = 1,
  lines_col = "black",
  scale_col = c("#010059", "#e0f6fb")
)

Arguments

x

an object of class "surv_prediction_breakdown_explainer"

...

optional, additional objects of class "surv_prediction_breakdown_explainer"

numerate

logical; indicating whether we want to number curves

lines

logical; indicating whether we want to add lines on chosen time point or probability

lines_type

a type of line; see http://sape.inf.usi.ch/quick-reference/ggplot2/linetype

lines_col

a color of line

scale_col

a vector containig two colors for gradient scale in legend

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)
broken_prediction <- prediction_breakdown(surve_cph, pbcTest[1,-c(1,5)])
plot(broken_prediction)


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