Description Usage Arguments Details Value Examples
Produce a summary of survival probabilities at selected time points from parametric survival models
1 2 | survivalLandmarkSummary(survival.models, time.points = c(1, 3, 5, 10),
time.unit = 365.25, dp = 3, ...)
|
survival.models |
A named list of survival models as returned by
|
time.points |
A vector of time points to produce summaries. Defaults are 1, 3, 5 and 10 years |
time.unit |
Preferred time units. This sets a multiplier to calculate landmark time points. Default is 365.25 to give time points in years. Survival at 5 years would calculated as 5 x time.unit = 5 x 365.25 = 1826.25 days. It is assumed that time in the survival model was in days. For months set this to 30.4. For days set this to 1. Only days, months or years are recognised |
dp |
Number of decimal places in the estimates. Default = 3 |
... |
Additional arguments to be passed to summary.flexsurvreg NOT TESTED |
Note that this has only been tested for simple models with a single covariate, e.g treatment
A data frame with survival probabilities (including 95
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | library(flexsurv)
library(survtools)
# Load data ---------------------------------------------------------------
#load some example data from the flexsurv package
#Survival times of 686 patients with primary node positive breast cancer
#censrec = censoring, 1 = dead, 0 = censored
#rectime = time of death or censoring in days
#recyrs = time of death or censoring in years
#group = prognostic group
data(bc)
# Fit parametric survival models -------------------------------------------
#fit 6 standard distributions
#this fits the distributions and collects the model fit objects in a list
#Simple model estimating survival for each prognostic group
psm.list <- list(
exp = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'exp'),
weibull = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'weibull'),
gompertz = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'gompertz'),
llog = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'llogis'),
lnorm = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'lnorm'),
gengamma = flexsurvreg(Surv(rectime, censrec) ~ group, data = bc, dist = 'gengamma')
)
#Get summaries an 1, 3, 5, 10 and 15 years. Note that time was modelled above in days
landmark.summ <- survivalLandmarkSummary(survival.models = psm.list, time.points = c(1, 3, 5, 10, 15),
time.unit = 365.25, dp = 3)
#Simpler model estimating survival for the whole cohort
psm.single <- list(
exp = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'exp'),
weibull = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'weibull'),
gompertz = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'gompertz'),
llog = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'llogis'),
lnorm = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'lnorm'),
gengamma = flexsurvreg(Surv(rectime, censrec) ~ 1, data = bc, dist = 'gengamma')
)
#Get summaries an 1, 3, 5, 10 and 15 years. Note that time was modelled above in days
landmark.summ <- survivalLandmarkSummary(survival.models = psm.single, time.points = c(1, 3, 5, 10, 15),
time.unit = 365.25, dp = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.