Learn R Programming

flexsurv (version 1.0.0)

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

Description

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.

Arguments

User guide

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.

Related R packages

flexsurv was written to encourage the use of flexible distributions to account for model uncertainty in survival analysis, initially the three-parameter generalized gamma, four-parameter generalized F and the Royston-Parmar spline model. However it was straightforward to modularise the design of the code to accept any generic parametric distribution. survreg from the survival package, the recommended R package for survival analysis, supports two-parameter location-scale parametric models. The eha package includes functions phreg and aftreg for parametric survival modelling under a variety of distributions and proportional hazards or accelerated failure time parameterisations. Other facilities for generic maximum likelihood model fitting exist, for example fitdistr in the MASS package. flexsurvreg is intended to provide typical outputs and summaries of interest to survival analysts, particularly in medical applications. Feature requests along these lines are welcome. Note that if an R package provides density and probability functions for a parametric distribution, it can then be used easily in flexsurvreg. For instance, several ``reliability'' distributions used in industrial statistics are available in the VGAM and package, and many other survival distributions are provided in ActuDistns. Please report unexplained inconsistencies in results between flexsurv and other software.

Details

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.

References

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