R code for Martingale residuals of a parametric survival model

Martingale residuals are helpful for detecting the correct functional form of a continuous predictor in a survival model. A mathematical definition of Martingale like residuals for the Accelerated Failure Time model (which is a parametric survival model) can be found in Collett’s 2003 book Modelling survival data in medical research. The R code implements Collett’s approach to Martingale residuals for the AFT model.

AFT model Martingale residuals

Continue reading R code for Martingale residuals of a parametric survival model

R code for constructing likelihood based confidence intervals for the regression coefficients of an Accelerated Failure Time model

The following R code computes likelihood based confidence intervals for the regression coefficients of an Accelerated Failure Time model. The AFT model is a parametric survival model.

AFT model coefficients

Continue reading R code for constructing likelihood based confidence intervals for the regression coefficients of an Accelerated Failure Time model

R code for constructing likelihood based confidence intervals for parametric survival models

The following R code may be used for constructing likelihood based intervals for parametric survival models (such as the Weibull model). These likelihood based intervals are also known as likelihood ratio bounds, or profile likelihood intervals.

The code constructs confidence intervals for the two distribution parameters of the parametric surival model (location μ and scale σ), life time quantiles tp, and failure probabilities F(te).

The R code focuses on the Weibull distribution, but can easily be adapted for modeling with other distributions (e.g., lognormal distribution).

Continue reading R code for constructing likelihood based confidence intervals for parametric survival models