| Maintainer: | Arthur Allignol, Aurelien Latouche |
| Contact: | arthur.allignol at gmail.com |
| Version: | 2025-02-09 |
| URL: | https://CRAN.R-project.org/view=Survival |
| Source: | https://github.com/cran-task-views/Survival/ |
| Contributions: | Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see theContributing guide. |
| Citation: | Arthur Allignol, Aurelien Latouche (2025). CRAN Task View: Survival Analysis. Version 2025-02-09. URL https://CRAN.R-project.org/view=Survival. |
| Installation: | The packages from this task view can be installed automatically using thectv package. For example,ctv::install.views("Survival", coreOnly = TRUE) installs all the core packages orctv::update.views("Survival") installs all packages that are not yet installed and up-to-date. See theCRAN Task View Initiative for more details. |
Survival analysis, also called event history analysis in social science, or reliability analysis in engineering, deals with time until occurrence of an event of interest. However, this failure time may not be observed within the relevant time period, producing so-called censored observations.
This task view aims at presenting the useful R packages for the analysis of time to event data.
Please let the maintainers know if something is inaccurate or missing, either via e-mail or by submitting an issue or pull request in the GitHub repository linked above.
Kaplan-Meier: Thesurvfit function from thesurvival package computes the Kaplan-Meier estimator for truncated and/or censored data.rms (replacement of the Design package) proposes a modified version of thesurvfit function. Theprodlim package implements a fast algorithm and some features not included insurvival. Various confidence intervals and confidence bands for the Kaplan-Meier estimator are implemented in thekm.ci package.plot.Surv of packageeha plots the Kaplan-Meier estimator. TheNADA package includes a function to compute the Kaplan-Meier estimator for left-censored data.svykm insurvey provides a weighted Kaplan-Meier estimator. Thekaplan-meier function inspatstat computes the Kaplan-Meier estimator from histogram data. TheKM function in packagerhosp(archived) plots the survival function using a variant of the Kaplan-Meier estimator in a hospitalisation risk context. ThesurvPresmooth package computes presmoothed estimates of the main quantities used for right-censored data, i.e., survival, hazard and density functions. Theasbio package permits to compute the Kaplan-Meier estimator following Pollock et al. (1998). Thebpcp package provides several functions for computing confidence intervals of the survival distribution (e.g., beta product confidence procedure). Thekmc package implements the Kaplan-Meier estimator with constraints. Thelandest package allows landmark estimation and testing of survival probabilities. ThecondSURV package provides methods for estimating the conditional survival function for ordered multivariate failure time data. Thegte package implements the generalised Turnbull estimator proposed by Dehghan and Duchesne for estimating the conditional survival function with interval-censored data.
Non-Parametric maximum likelihood estimation (NPMLE): The
Icens package provides several ways to compute the NPMLE of the survival distribution for various censoring and truncation schemes.MLEcens can also be used to compute the MLE for interval-censored data.dblcens permits to compute the NPMLE of the cumulative distribution function for left- and right-censored data. Theicfit function in packageinterval computes the NPMLE for interval-censored data. TheDTDA package implements several algorithms permitting to analyse possibly doubly truncated survival data.
npsurv computes the NPMLE of a survival function for general interval-censored data. Thecsci package provides confidence intervals for the cumulative distribution function of the event time for current status data, including a new method that is valid (i.e., exact).
Parametric: Thefitdistrplus package permits to fit an univariate distribution by maximum likelihood. Data can be interval censored. Thevitality package provides routines for fitting models in the vitality family of mortality models.
epi.insthaz function fromepiR computes the instantaneous hazard from the Kaplan-Meier estimator.survdiff function insurvival compares survival curves using the Fleming-Harrington G-rho family of test.NADA implements this class of tests for left-censored data.SurvTest in thecoin package implements the logrank test reformulated as a linear rank test.coxph function in thesurvival package fits the Cox model.cph in therms package and theeha package propose some extensions to thecoxph function. The packagecoxphf implements the Firth’s penalised maximum likelihood bias reduction method for the Cox model. An implementation of weighted estimation in Cox regression can be found incoxphw. Thecoxrobust package proposes a robust implementation of the Cox model.timecox in packagetimereg fits Cox models with possibly time-varying effects. A Cox model model can be fitted to data from complex survey design using thesvycoxph function insurvey. ThemultipleNCC package fits Cox models using a weighted partial likelihood for nested case-control studies. TheICsurv package fits Cox models for interval-censored data through an EM algorithm. Thedynsurv package fits time-varying coefficient models for interval censored and right censored survival data using a Bayesian Cox model, a spline based Cox model or a transformation model. TheOrdFacReg package implements the Cox model using an active set algorithm for dummy variables of ordered factors. ThesurvivalMPL package fits Cox models using maximum penalised likelihood and provide a non parametric smooth estimate of the baseline hazard function. A Cox model with piecewise constant hazards can be fitted using thepch package. TheicenReg package implements several models for interval-censored data, e.g., Cox, proportional odds, and accelerated failure time models. A Cox type Self-Exciting Intensity model can be fitted to right-censored data using thecoxsei package. TheSurvLong contains methods for estimation of proportional hazards models with intermittently observed longitudinal covariates. Theplac package provides routines to fit the Cox model with left-truncated data using augmented information from the marginal of the truncation times. Theboot.pval package contains the convenience functioncensboot_summary for computing bootstrap p-values and confidence intervals for Cox models.cox.zph function insurvival. ThecoxphCPE function inclinfun calculates concordance probability estimate for the Cox model. ThecoxphQuantile in the latter package draws a quantile curve of the survival distribution as a function of covariates. Themultcomp package computes simultaneous tests and confidence intervals for the Cox model and other parametric survival models. Thelsmeans package permits to obtain least-squares means (and contrasts thereof) from linear models. In particular, it provides support for thecoxph,survreg andcoxme functions. Themulttest package on Bioconductor proposes a resampling based multiple hypothesis testing that can be applied to the Cox model. Testing coefficients of Cox regression models using a Wald test with a sandwich estimator of variance can be done using thesaws package. Therankhazard package permits to plot visualisation of the relative importance of covariates in a proportional hazards model. ThesmoothHR package provides hazard ratio curves that allows for nonlinear relationship between predictor and survival. ThePHeval package proposes tools to check the proportional hazards assumption using a standardised score process. TheELYP package implements empirical likelihood analysis for the Cox Model and Yang-Prentice (2005) Model.survreg (fromsurvival) fits a parametric proportional hazards model. Theeha andmixPHM packages implement a proportional hazards model with a parametric baseline hazard. Thepphsm inrms translates an AFT model to a proportional hazards form. Thepolspline package includes thehare function that fits a hazard regression model, using splines to model the baseline hazard. Hazards can be, but not necessarily, proportional. Theflexsurv package implements the model of Royston and Parmar (2002). The model uses natural cubic splines for the baseline survival function, and proportional hazards, proportional odds or probit functions for regression. TheSurvRegCensCov package allows estimation of a Weibull Regression for a right-censored endpoint, one interval-censored covariate, and an arbitrary number of non-censored covariates.survreg function in packagesurvival can fit an accelerated failure time model. A modified version ofsurvreg is implemented in therms package (psm function). It permits to use some of therms functionalities. Theeha package also proposes an implementation of the AFT model (functionaftreg). TheNADA package proposes the front end of thesurvreg function for left-censored data. Thesimexaft(archived) package implements the Simulation-Extrapolation algorithm for the AFT model, that can be used when covariates are subject to measurement error. A robust version of the accelerated failure time model can be found inRobustAFT. ThecoarseDataTools package fits AFT models for interval censored data. Theaftgee package implements recently developed inference procedures for the AFT models with both the rank-based approach and the least squares approach. Theboot.pval package contains the convenience functioncensboot_summary for computing bootstrap p-values and confidence intervals for AFT models.aareg andaalen, respectively.timereg also proposes an implementation of the Cox-Aalen model (that can also be used to perform the Lin, Wei and Ying (1994) goodness-of-fit for Cox regression models) and the partly parametric additive risk model of McKeague and Sasieni. Theuniah package fits shape-restricted additive hazards models. Theaddhazard package contains tools to fit additive hazards model to random sampling, two-phase sampling and two-phase sampling with auxiliary information.bj function inrms andBJnoint inemplik compute the Buckley-James model, though the latter does it without an intercept term. Thebujar package fits the Buckley-James model with high-dimensional covariates (L2 boosting, regression trees and boosted MARS, elastic net).survreg can fit other types of models depending on the chosen distribution,e.g. , a tobit model. TheAER package provides thetobit function, which is a wrapper ofsurvreg to fit the tobit model. An implementation of the tobit model for cross-sectional data and panel data can be found in thecensReg package. Ther pkg("timereg") package provides implementation of the proportional odds model and of the proportional excess hazards model. TheinvGauss package fits the inverse Gaussian distribution to survival data. The model is based on describing time to event as the barrier hitting time of a Wiener process, where drift towards the barrier has been randomized with a Gaussian distribution. Thepseudo package computes the pseudo-observation for modelling the survival function based on the Kaplan-Meier estimator and the restricted mean.r pkg("flexsurv") fits parametric time-to-event models, in which any parametric distribution can be used to model the survival probability, and where any of the parameters can be modelled as a function of covariates. TheIcens function in packager pkg("Epi") provides a multiplicative relative risk and an additive excess risk model for interval-censored data. Ther pkg("VGAM") package can fit vector generalised linear and additive models for censored data. Thegamlss.cens package implements the generalised additive model for location, scale and shape that can be fitted to censored data. Thelocfit.censor function inlocfit produces local regression estimates. Thecrq function included in ther pkg("quantreg") package implements a conditional quantile regression model for censored data. TheJM package fits shared parameter models for the joint modelling of a longitudinal response and event times. The temporal process regression model is implemented in thetpr package. Aster models, which combine aspects of generalized linear models and Cox models, are implemented in theaster andaster2 packages. Thesurv2sampleComp packages proposes some model-free contrast comparison measures such as difference/ratio of cumulative hazards, quantiles and restricted mean. Ther pkg("rstpm2") package provides link-based survival models that extend the Royston-Parmar models, a family of flexible parametric models. TheTransModel package implements a unified estimation procedure for the analysis of censored data using linear transformation models. TheICGOR fits the generalized odds rate hazards model to interval-censored data whileGORCure generalized odds rate mixture cure model to interval-censored data. ThethregI package permits to fit a threshold regression model for interval-censored data based on the first-hitting-time of a boundary by the sample path of a Wiener diffusion process. ThemiCoPTCM package fits semiparametric promotion time cure models with possibly mis-measured covariates. Thesmcure package permits to fit semiparametric proportional hazards and accelerated failure time mixture cure models. The case-base sampling approach for fitting flexible hazard regression models to survival data with single event type or multiple competing causes via logistic and multinomial regression can be found in packager pkg("casebase"). Theintsurv package fits regular Cox cure rate model via an EM algorithm, regularized Cox cure rate model with elastic net penalty, and weighted concordance index for cure models. TheGJRM package supports univariate proportional hazard, proportional odds and probit link models where the baseline and many types of covariate effects (including spatial and time-dependent effects) are modelled flexibly by means of penalised smoothers (e.g., penalised thin plate, monotonic B- and cubic splines, tensor products and Markov random fields). Right, left and interval censoring and left truncation can also be accounted for. This is done through the functiongamlss. The packagetram allows a range of stratified linear transformation models to be fitted, among them Cox models and other parametric models. It allows to also estimate flexible survival models for interval-censored data in a straightforward manner, and has many useful extensions. Modeling periodic mortality (or other time-to event) processes from right-censored data can be done using thecyclomort package.coxph function from packagesurvival can be fitted for any transition of a multistate model. It can also be used for comparing two transition hazards, using correspondence between multistate models and time-dependent covariates. Besides, all the regression methods presented above can be used for multistate models as long as they allow for left-truncation. Themvna package provides convenient functions for estimating and plotting the cumulative transition hazards in any multistate model, possibly subject to right-censoring and left-truncation. Theetm package estimates and plots transition probabilities for any multistate models. It can also estimate the variance of the Aalen-Johansen estimator, and handles left-truncated data. Themstate package permits to estimate hazards and probabilities, possibly depending on covariates, and to obtain prediction probabilities in the context of competing risks and multistate models. Theflexsurv package can fit and predict from fully-parametric multistate models, with arbitrarily-flexible time-to-event distributions, using either a cause-specific hazards or mixture model framework. Themsm package contains functions for fitting general continuous-time Markov and hidden Markov multistate models to longitudinal data. Transition rates and output processes can be modelled in terms of covariates. Theflexmsm package provides a general estimation framework for multi-state Markov processes with flexible specification of the transition intensities. It supports any type of process structure (forward and backward transitions, any number of states) and transition intensities can be specified via Generalised Additive Models, with syntax similar to that used for GAMs in R. TheSemiMarkov package can be used to fit semi-Markov multistate models in continuous time. The distribution of the waiting times can be chosen between the exponential, the Weibull and exponentiated Weibull distributions. TheTPmsm package permits to estimate transition probabilities of an illness-death model or three-state progressive model. ThegamboostMSM(archived) package extends themboost package to estimation in the mulstistate model framework, while thepenMSM package proposes L1 penalised estimation. TheTP.idm(archived) package implement the estimator of Una-Alvarez and Meira-Machado (2015) for non-Markov illness-death models.survfit) andprodlim can also be used to estimate the cumulative incidence function. TheNPMLEcmprsk package implements the semi-parametric mixture model for competing risks data. TheCFC package permits to perform Bayesian, and non-Bayesian, cause-specific competing risks analysis for parametric and non-parametric survival functions. Thegcerisk package provides some methods for competing risks data. Estimation, testing and regression modeling of subdistribution functions in the competing risks setting using quantile regressions can be had incmprskQR. Theintccr package permits to fit the Fine and Gray model as well other models that belong to the class of semiparametric generalized odds rate transformation models to interval-censored competing risks data. Themmcif(archived) fits mixed cumulative incidence function models to model within-cluster dependence of both risk and timing.coxph from thesurvival package can be used to analyse recurrent event data. Thecph function of therms package fits the Anderson-Gill model for recurrent events, model that can also be fitted with thefrailtypack package. The latter also permits to fit joint frailty models for joint modelling of recurrent events and a terminal event. ThecondGEE package implements the conditional GEE for recurrent event gap times. Thereda package provides function to fit gamma frailty model with either a piecewise constant or a spline as the baseline rate function for recurrent event data, as well as some miscellaneous functions for recurrent event data. Several regression models for recurrent event data are implemented in thereReg package. Thespef package includes functions for fitting semiparametric regression models for panel count survival data.rs.surv computes a relative survival curve.rs.add fits an additive model andrsmul fits the Cox model of Andersen et al. for relative survival, whilerstrans fits a Cox model in transformed time.coxph function in packagesurvival. A mixed-effects Cox model is implemented in thecoxme package. Thetwo.stage function in thetimereg package fits the Clayton-Oakes-Glidden model. Thefrailtypack package fits proportional hazards models with a shared Gamma frailty to right-censored and/or left-truncated data using a penalised likelihood on the hazard function. The package also fits additive and nested frailty models that can be used for, e.g., meta-analysis and for hierarchically clustered data (with 2 levels of clustering), respectively. The Cox model using h-likelihood estimation for the frailty terms can be fitted using thefrailtyHL package. ThefrailtySurv package simulates and fits semiparametric shared frailty models under a wide range of frailty distributions. ThePenCoxFrail package provides a regularisation approach for Cox frailty models through penalisation. Themexhaz enables modelling of the excess hazard regression model with time-dependent and/or non-linear effect(s) and a random effect defined at the cluster level. ThefrailtyEM package contains functions for fitting shared frailty models with a semi-parametric baseline hazard with the Expectation-Maximization algorithm. Supported data formats include clustered failures with left truncation and recurrent events in gap-time or Andersen-Gill formatMultivariate survival refers to the analysis of unit, e.g., the survival of twins or a family. To analyse such data, we can estimate the joint distribution of the survival times
NMixMCMC inmixAK performs an MCMC estimation of normal mixtures for censored data.MCMCtobit inMCMCpack.weibullregpost function inLearnBayes computes the log posterior density for a Weibull proportional-odds regression model.This section tries to list some specialised plot functions that might be useful in the context of event history analysis.
plot.Hist function inprodlim permits to draw the states and transitions that characterize a multistate model.ggsurvplot for drawing survival curves with the “number at risk” table. Other functions are also available for visual examinations of Cox model assumptions.censboot function that implements several types of bootstrap techniques for right-censored data. Theboot.pval package contains the convenience functioncensboot_summary for computing bootstrap p-values and confidence intervals for Cox models and accelerated failure time models.