## R code for constructing likelihood based confidence intervals for the life time quantiles of a competing risks model

Competing risks model are employed when, for instance, a device has two different causes of failure (also referred to as failure modes). The R code below shows how to model the failure data of such a device with a competing risks model.
Furthermore, the R code demonstrates how to compute likelihood based confidence intervals for the life time quantiles of the competing risks model. In computing these confidence intervals the R code assumes that the observed failure times follow a Weibull distribution. However, it will also be demonstrated how to adapt the code in case the failure times follow a lognormal distribution.
It should be noted that the competing risks model in the R code focuses on a situation in which a device has two failure modes. Nevertheless, the code can easily be extended to include more than two failure modes. ## R code for constructing likelihood based confidence intervals for the cumulative probabilities and quantiles of an Accelerated Failure Time model

Failure times may be modeled as a function of explanatory variables. The Accelerated Failure Time model (AFT model) is often used for finding the relationship between failure times and explanatory variables.
In a reliability engineering context, for instance, an Accelerated Life Test is often used for determining the effect of variables (such as temperature or voltage) on the durability of some component. For relating the variables to the durability of the component, the reliability engineer usually employs an AFT model.
The following R code computes the likelihood based confidence intervals at specific values of the explanatory variables for 1) the cumulative probabilities, and 2) the quantiles. Note that a reliability engineer may refer to the cumulative probabilities as failure probabilities, and to the quantiles as life time quantiles. ## R code for fitting an Accelerated Life Test Model

The following code may be used for fitting an accelerated life test model in R.

Currently the R code implements the lognormal and Weibull distribution for failure times. However, the code can be easily adapted to implement other distributions as well (such as the Gumbel distribution). As an example, temperature (on the Arrhenius scale) is used as acceleration factor in the code. But it also possible to use other acceleration factors (for instance, voltage stress). Moreover, the code can be extended to include multiple accelerators in the accelerated life test model, and even their interaction.

## R code for constructing likelihood based confidence intervals when summing two random variables (part 2)

The following R-code may be used for computing likelihood based confidence intervals when adding two random variables.

A practical example
A device is known to fail due to material cracks. The failure time for this device is obtained by summing the onset time (X) and growth time (Y) of the cracks. Both X and Y are random variables and are assumed to follow a Weibull distribution.

What is the failure time when the probability of failure for X+Y is less than, say, 0.1%? Stated differently, when observing both the onset and growth times of the material cracks, what is the time at which a proportion of .001 of these devices will have failed? This time corresponds to the .001 quantile.

The method for computing likelihood based confidence intervals for these quantiles is similar to the one that was used in this blog post. That post discusses how to sum random variables and also demonstrates how to compute likelihood based confidence intervals for cumulative probabilities. ## R code for computing quantiles of a Finite Mixture Fatigue Limit Model

In one of my previous posts I demonstrated how to fit a Finite Mixture Fatigue Limit Model to fatigue data.
The following R code computes the quantiles of a mixture fitted by the Finite Mixture Fatigue Limit Model. 