ParamEtRic SUrvivAl moDel sElection
A standardized R tool to support the selection, comparison, and communication of parametric survival models, and their implementation in decision-analytic models.
PERSUADE guides analysts through a reproducible workflow for survival analysis and model selection. It provides:
The framework is designed for transparency and consistency when survival analysis feeds into decision-analytic models.
install.packages("PERSUADE")
devtools::install_github("Bram-R/PERSUADE", quiet = TRUE, upgrade = "never")
library(PERSUADE)
The easiest way to get started is by running the example workflow
script: PERSUADE_example_workflow.R
using:
file.edit(system.file("example_workflow", "PERSUADE_example_workflow.R", package = "PERSUADE"))
This script:
f_PERSUADE()
).print()
,
summary()
, and plot()
.f_generate_report()
.library(PERSUADE)
<- f_PERSUADE(
PERSUADE name = "BC_OS",
years = flexsurv::bc$recyrs, # time-to-event
status = flexsurv::bc$censrec, # event indicator
group = flexsurv::bc$group, # grouping variable
strata = TRUE,
spline_mod = TRUE,
cure_mod = TRUE,
time_unit = 1/12, # months in years
time_horizon = 40,
time_pred_surv_table = c(0, 1, 2, 5, 10, 20, 30, 40)
)
print(PERSUADE)
# Kaplan-Meier estimates
summary(PERSUADE, type = "km")
# Survival probabilities at time points
summary(PERSUADE, type = "surv_probs")
# Goodness-of-fit for standard parametric models
summary(PERSUADE, type = "gof")
# Goodness-of-fit for spline-based models
summary(PERSUADE, type = "gof_spline")
# Goodness-of-fit for cure models
summary(PERSUADE, type = "gof_cure")
# Set colour palette for Figures
palette(rainbow(n = 9, s = 1, v = 1, start = 0, end = max(1, 9 - 1)/9, alpha = 1))
# Kaplan-Meier curves
plot(PERSUADE, type = "km")
# Proportional hazards diagnostics
plot(PERSUADE, type = "ph")
# Observed smoothed hazard
plot(PERSUADE, type = "hr")
# Standard parametric models
plot(PERSUADE, type = "param_models")
# Spline-based models
plot(PERSUADE, type = "spline_models")
# Cure models
plot(PERSUADE, type = "cure_models")
# Set colour palette to default
palette("default")
f_generate_report(PERSUADE)
# Copy to clipboard (for copying in PERSUADE Excel template.xltx)
write.table(PERSUADE$surv_model_excel, "clipboard-128", sep = "\t", col.names = FALSE)
# Export to CSV (change `tempdir()` into `getwd()` for copying to working directory)
write.csv(PERSUADE$surv_model_excel,
file.path(tempdir(), paste0(name, "_output"),
"PERSUADE_Time-to-event_models_parameters_comma.csv"))
write.csv2(PERSUADE$surv_model_excel,
file.path(tempdir(), paste0(name, "_output"),
"PERSUADE_Time-to-event_models_parameters_semicolon.csv"))
f_get_excel_template()
Visualize the process via the included diagram:
(Alternatively, open the .vsdx
version if
preferred.)
Start by running the example script to familiarize yourself with the workflow. For your own data:
PERSUADE_example_workflow.R
using:
file.edit(system.file("example_workflow", "PERSUADE_example_workflow.R", package = "PERSUADE"))
;
see also vignette using: browseVignettes("PERSUADE")
name
parameterf_PERSUADE(...)
, toggle options
(TRUE
/FALSE
) for the analyses you want to
runf_PERSUADE()
.PERSUADE_output_functions.R
or adopt themes for
publication-quality graphics.Licensed under GPL3.
For questions, enhancements, or collaboration, reach out via GitHub
discussions or issues.