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.

# Tag: competing risks model

## R code for fitting a two-failure mode model

A system or component can fail in different ways. For instance, a device may fail due to 1) an electrical surge, or 2) wearout. When a system fails due to two such failure modes, it may be better to model the failure times with a two-failure mode model (which is also known as a competing risks model).

The following R code fits a two-failure mode model. This R code assumes that the failure times of both failure modes follow a Weibull distribution. However, the code can be easily adapted to implement other distributions as well (such as the lognormal distribution). Furthermore, the R code can be extended to include more than two failure modes.

The R code also demonstrates how to construct *normal-approximation* and *likelihood* based intervals for the failure probabilities of a two-failure mode model. In addition, the code computes the *median* and *mean* life time for a two-failure mode model.

Continue reading R code for fitting a two-failure mode model