Skip to contents

Fitting survival models

flexsurvreg()
Flexible parametric regression for time-to-event data
flexsurvspline()
Flexible survival regression using the Royston/Parmar spline model.
flexsurvrtrunc()
Flexible parametric models for right-truncated, uncensored data defined by times of initial and final events.
survrtrunc()
Nonparametric estimator of survival from right-truncated, uncensored data

Getting results from survival models

summary(<flexsurvreg>)
Summaries of fitted flexible survival models
standsurv()
Marginal survival and hazards of fitted flexsurvreg models
coef(<flexsurvreg>)
Extract model coefficients from fitted flexible survival models
normboot.flexsurvreg()
Simulate from the asymptotic normal distribution of parameter estimates.
hr_flexsurvreg()
Hazard ratio as a function of time from a parametric survival model
vcov(<flexsurvreg>)
Variance-covariance matrix from a flexsurvreg model
simulate(<flexsurvreg>)
Simulate censored time-to-event data from a fitted flexsurvreg model
plot(<flexsurvreg>)
Plots of fitted flexible survival models
lines(<flexsurvreg>)
Add fitted flexible survival curves to a plot
plot(<standsurv>)
Plot standardized metrics from a fitted flexsurv model
summary(<flexsurvrtrunc>)
Summarise quantities of interest from fitted flexsurvrtrunc models
plot(<survrtrunc>) lines(<survrtrunc>)
Plot nonparametric estimates of survival from right-truncated data.

Multi-state models based on transition-specific hazards

fmsm()
Construct a multi-state model from a set of parametric survival models
pars.fmsm()
Transition-specific parameters in a flexible parametric multi-state model
pmatrix.fs()
Transition probability matrix from a fully-parametric, time-inhomogeneous Markov multi-state model
pmatrix.simfs()
Transition probability matrix from a fully-parametric, semi-Markov multi-state model
totlos.fs()
Total length of stay in particular states for a fully-parametric, time-inhomogeneous Markov multi-state model
totlos.simfs()
Expected total length of stay in specific states, from a fully-parametric, semi-Markov multi-state model
sim.fmsm()
Simulate paths through a fully parametric semi-Markov multi-state model
simfs_bytrans()
Reformat simulated multi-state data with one row per simulated transition
bootci.fmsm()
Bootstrap confidence intervals for flexsurv output functions
pfinal_fmsm()
Probabilities of final states in a flexible parametric competing risks model
simfinal_fmsm()
Simulate and summarise final outcomes from a flexible parametric multi-state model
ajfit_fmsm()
Check the fit of Markov flexible parametric multi-state models against nonparametric estimates.
msfit.flexsurvreg()
Cumulative intensity function for parametric multi-state models

Competing risks and multi-state models based on mixtures

flexsurvmix()
Flexible parametric mixture models for times to competing events
get_basepars()
Evaluate baseline time-to-event distribution parameters given covariate values in a flexsurvmix model
mean_flexsurvmix()
Mean times to events from a flexsurvmix model
pdf_flexsurvmix()
Fitted densities for times to events in a flexsurvmix model
probs_flexsurvmix()
Probabilities of competing events from a flexsurvmix model
p_flexsurvmix()
Transition probabilities from a flexsurvmix model
quantile_flexsurvmix()
Quantiles of time-to-event distributions in a flexsurvmix model
rmst_flexsurvmix()
Restricted mean times to events from a flexsurvmix model
simt_flexsurvmix()
Simulate times to competing events from a mixture multi-state model
fmixmsm()
Constructor for a mixture multi-state model based on flexsurvmix
meanfinal_fmixmsm()
Mean time to final state in a mixture multi-state model
ppath_fmixmsm()
Probability of each pathway taken through a mixture multi-state model
qfinal_fmixmsm()
Quantiles of the distribution of the time until reaching a final state in a mixture multi-state model
ajfit()
Aalen-Johansen nonparametric estimates comparable to a fitted flexsurvmix model
ajfit_flexsurvmix()
Forms a tidy data frame for plotting the fit of parametric mixture multi-state models against nonparametric estimates

Model comparison and checking

logLik(<flexsurvreg>)
Log likelihood from a flexsurvreg model
AICc(<flexsurvreg>) AICC(<flexsurvreg>)
Second-order Akaike information criterion
AICc() AICC()
Second-order Akaike information criterion
BIC(<flexsurvreg>)
Bayesian Information Criterion (BIC) for comparison of flexsurvreg models
AIC(<fmsm>)
Akaike's information criterion from a flexible parametric multistate model
nobs(<flexsurvreg>)
Number of observations contributing to a fitted flexible survival model
residuals(<flexsurvreg>)
Calculate residuals for flexible survival models
coxsnell_flexsurvreg()
Cox-Snell residuals from a parametric survival model

Probability distributions

dsurvspline() psurvspline() qsurvspline() rsurvspline() Hsurvspline() hsurvspline() rmst_survspline() mean_survspline()
Royston/Parmar spline survival distribution
mean_survspline0() mean_survspline1() mean_survspline2() mean_survspline3() mean_survspline4() mean_survspline5() mean_survspline6() mean_survspline7() rmst_survspline0() rmst_survspline1() rmst_survspline2() rmst_survspline3() rmst_survspline4() rmst_survspline5() rmst_survspline6() rmst_survspline7() dsurvspline0() dsurvspline1() dsurvspline2() dsurvspline3() dsurvspline4() dsurvspline5() dsurvspline6() dsurvspline7() psurvspline0() psurvspline1() psurvspline2() psurvspline3() psurvspline4() psurvspline5() psurvspline6() psurvspline7() qsurvspline0() qsurvspline1() qsurvspline2() qsurvspline3() qsurvspline4() qsurvspline5() qsurvspline6() qsurvspline7() rsurvspline0() rsurvspline1() rsurvspline2() rsurvspline3() rsurvspline4() rsurvspline5() rsurvspline6() rsurvspline7() hsurvspline0() hsurvspline1() hsurvspline2() hsurvspline3() hsurvspline4() hsurvspline5() hsurvspline6() hsurvspline7() Hsurvspline0() Hsurvspline1() Hsurvspline2() Hsurvspline3() Hsurvspline4() Hsurvspline5() Hsurvspline6() Hsurvspline7()
Royston/Parmar spline survival distribution functions with one argument per parameter
dweibullPH() pweibullPH() qweibullPH() hweibullPH() HweibullPH() rweibullPH()
Weibull distribution in proportional hazards parameterisation
dgengamma() pgengamma() Hgengamma() hgengamma() qgengamma() rgengamma()
Generalized gamma distribution
dgengamma.orig() pgengamma.orig() Hgengamma.orig() hgengamma.orig() qgengamma.orig() rgengamma.orig()
Generalized gamma distribution (original parameterisation)
dgenf() pgenf() Hgenf() hgenf() qgenf() rgenf()
Generalized F distribution
dgenf.orig() pgenf.orig() Hgenf.orig() hgenf.orig() qgenf.orig() rgenf.orig()
Generalized F distribution (original parameterisation)
dgompertz() pgompertz() qgompertz() rgompertz() hgompertz() Hgompertz()
The Gompertz distribution
dllogis() pllogis() qllogis() rllogis() hllogis() Hllogis()
The log-logistic distribution
hexp() Hexp() hgamma() Hgamma() hlnorm() Hlnorm() hweibull() Hweibull()
Hazard and cumulative hazard functions
mean_exp() rmst_exp() mean_gamma() rmst_gamma() rmst_genf() mean_genf() rmst_genf.orig() mean_genf.orig() rmst_gengamma() mean_gengamma() rmst_gengamma.orig() mean_gengamma.orig() rmst_gompertz() mean_gompertz() mean_llogis() rmst_llogis() mean_lnorm() rmst_lnorm() mean_weibull() rmst_weibull() rmst_weibullPH() mean_weibullPH()
Mean and restricted mean survival functions
qgeneric()
Generic function to find quantiles of a distribution

Tools for using flexsurv with tidyverse

predict(<flexsurvreg>)
Predictions from flexible survival models
tidy(<flexsurvreg>)
Tidy a flexsurv model object
tidy(<standsurv>)
Tidy a standsurv object.
augment(<flexsurvreg>)
Augment data with information from a flexsurv model object
glance(<flexsurvreg>)
Glance at a flexsurv model object

Datasets

bc
Breast cancer survival data
bos bosms3 bosms4
Bronchiolitis obliterans syndrome after lung transplants

Miscellaneous / advanced tools

model.frame(<flexsurvreg>) model.matrix(<flexsurvreg>)
Extract original data from flexsurvreg objects.
model.frame(<flexsurvmix>)
Model frame from a flexsurvmix object
basis()
Natural cubic spline basis
rmst_generic()
Generic function to find restricted mean survival time for some distribution
unroll.function()
Convert a function with matrix arguments to a function with vector arguments.

Package overview

flexsurv-package flexsurv
flexsurv: Flexible parametric survival and multi-state models