plot.model_profile_2d_survival {survex} | R Documentation |
Plot 2-Dimensional Model Profile for Survival Models
Description
This function plots objects of class "model_profile_2d_survival"
created
using the model_profile_2d()
function.
Usage
## S3 method for class 'model_profile_2d_survival'
plot(
x,
...,
variables = NULL,
times = NULL,
marginalize_over_time = FALSE,
facet_ncol = NULL,
title = "default",
subtitle = "default",
colors = NULL
)
Arguments
x |
an object of class |
... |
additional objects of class |
variables |
list of character vectors of length 2, names of pairs of variables to be plotted |
times |
numeric vector, times for which the profile should be plotted, the times must be present in the 'times' field of the explainer. If |
marginalize_over_time |
logical, if |
facet_ncol |
number of columns for arranging subplots |
title |
character, title of the plot. |
subtitle |
character, subtitle of the plot, |
colors |
character vector containing the colors to be used for plotting variables (containing either hex codes "#FF69B4", or names "blue") |
Value
A collection of ggplot
objects arranged with the patchwork
package.
Examples
library(survival)
library(survex)
cph <- coxph(Surv(time, status) ~ ., data = veteran, model = TRUE, x = TRUE, y = TRUE)
cph_exp <- explain(cph)
cph_model_profile_2d <- model_profile_2d(cph_exp,
variables = list(
c("age", "celltype"),
c("age", "karno")
)
)
head(cph_model_profile_2d$result)
plot(cph_model_profile_2d, variables = list(c("age", "celltype")), times = cph_exp$times[20])
cph_model_profile_2d_ale <- model_profile_2d(cph_exp,
variables = list(c("age", "karno")),
type = "accumulated"
)
head(cph_model_profile_2d_ale$result)
plot(cph_model_profile_2d_ale, times = cph_exp$times[c(10, 20)], marginalize_over_time = TRUE)