flexsurv-package: flexsurv: Flexible parametric models for time-to-event data

Description Details Related R packages Author(s) References


flexsurv: Flexible parametric models for time-to-event data, including the generalized gamma, the generalized F and the Royston-Parmar spline model.


flexsurvreg fits parametric models for time-to-event (survival) data. Data may be right-censored 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 and probability functions.

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, including a linear term for covariates. 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.

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.

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 package. Please report unexplained inconsistencies in results between flexsurv and other software.


Christopher Jackson [email protected]


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

flexsurv documentation built on May 31, 2017, 4:50 a.m.