flexsurv: Flexible parametric models for time-to-event data, including the generalized gamma, the generalized F and the Royston-Parmar spline model, and extensible to user-defined distributions.
The flexsurv user guide vignette explains the methods in detail, and gives several worked examples. A further vignette flexsurv-examples gives a few more complicated examples, and users are encouraged to submit their own.
Christopher Jackson chris.jackson@mrc-bsu.cam.ac.uk
flexsurvreg
fits parametric models for time-to-event
(survival) data. Data may be right-censored, and/or left-censored, and/or
left-truncated. Several built-in parametric distributions are available.
Any user-defined parametric model can also be employed by supplying a list
with basic information about the distribution, including the density or
hazard and ideally also the cumulative distribution or hazard.
Covariates can be included using a linear model on any parameter of the distribution, log-transformed to the real line if necessary. This typically defines an accelerated failure time or proportional hazards model, depending on the distribution and parameter.
flexsurvspline
fits the flexible survival model of Royston
and Parmar (2002) in which the log cumulative hazard is modelled as a
natural cubic spline function of log time. Covariates can be included on
any of the spline parameters, giving either a proportional hazards model or
an arbitrarily-flexible time-dependent effect. Alternative proportional
odds or probit parameterisations are available.
Output from the models can be presented as survivor, cumulative hazard and
hazard functions (summary.flexsurvreg
). These can be plotted
against nonparametric estimates (plot.flexsurvreg
) to assess
goodness-of-fit. Any other user-defined function of the parameters may be
summarised in the same way.
Multi-state models for time-to-event data can also be fitted with the same
functions. Predictions from those models can then be made using the
functions pmatrix.fs
, pmatrix.simfs
,
totlos.fs
, totlos.simfs
, or
sim.fmsm
, or alternatively by msfit.flexsurvreg
followed by mssample
or probtrans
from the package
mstate.
Distribution (``dpqr'') functions for the generalized gamma and F
distributions are given in GenGamma
, GenF
(preferred parameterisations) and GenGamma.orig
,
GenF.orig
(original parameterisations).
flexsurv
also includes the standard Gompertz distribution
with unrestricted shape parameter, see Gompertz
.
Jackson, C. (2016). flexsurv: A Platform for Parametric Survival Modeling in R. Journal of Statistical Software, 70(8), 1-33. doi:10.18637/jss.v070.i08
Royston, P. and Parmar, M. (2002). Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine 21(1):2175-2197.
Cox, C. (2008). The generalized \(F\) distribution: An umbrella for parametric survival analysis. Statistics in Medicine 27:4301-4312.
Cox, C., Chu, H., Schneider, M. F. and Muñoz, A. (2007). Parametric survival analysis and taxonomy of hazard functions for the generalized gamma distribution. Statistics in Medicine 26:4252-4374
Useful links: