R code for modeling with left truncated and right/interval censored data

Burn-in testing is used to screen out units or systems with short lifetimes. Units or systems that survived a burn-in test may give rise to left truncated data that is either right or interval censored.

Left truncated and right censored data
Tobias and Trindade reported in their 2012 book Applied Reliability on field failure times of units that survived a burn-in test of 5000 hours (Example 4.6, p. 109). These field failure times represent an example of left truncation in combination with right censoring.

Left truncated and interval censored data
Meeker and Escobar described in their 1998 book Statistical Methods for Reliability Data a field-tracking study of units that survived a 1000 hours burn-in test (Example 11.11, pp. 269-270). The data in Meeker and Escobar’s study is an example of left truncation in combination with interval censoring.

Model fitting using maximum likelihood optimization

The R code fits a Weibull (or lognormal) model to left truncated data that is either right or interval censored. The fitting of these models is done by log-likelihood optimization (using the optim function in R).

Continue reading R code for modeling with left truncated and right/interval censored data

R code for constructing likelihood based confidence intervals for the median residual life

The following R-code may be used for computing likelihood based confidence intervals for the median residual life.

Definition of the median residual life
The median residual life (or median remaining lifetime) of a unit at time t is given by:

\frac{1}{2}*S(t) = S(t + mdrl)

where mdrl is the median residual life, and S(·) the survival function of the failure times.

Computing likelihood based intervals for MDRL
The method for computing the likelihood based confidence interval for the median residual life is similar to the one I previously used for the mean residual life (this blog post explains the method for computing the likelihood based confidence intervals for the mean residual life).

median residual life

Continue reading R code for constructing likelihood based confidence intervals for the median residual life

R code for constructing likelihood based confidence intervals for the mean residual life

The following R-code may be used for computing likelihood based confidence intervals for the mean (or expected) residual life.

Definition of the mean residual life
The mean residual life (or expected remaining lifetime) of a unit at time t is given by:

MRL(t) = \frac{\int^{\infty}_{t} (u-t)f(u)\ du}{S(t)} = \frac{\int^{\infty}_{t} S(u) \ du}{S(t)}

where MRL(t) is the mean residual life at time t, f(·) the probability density function of the failure times, and S(·) the survival function. Continue reading R code for constructing likelihood based confidence intervals for the mean residual life

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 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