## R code for constructing likelihood based confidence intervals for stress-strength models

In my previous blog post I demonstrated how to compute bootstrap confidence intervals for stress-strength models.
The following R-code may be used for computing likelihood based confidence intervals for stress-strength models.

Definition of the unreliability in case of a stress-strength model
A component may fail when the stress (or load) exceeds the strength. Accordingly, the unreliability of the component is defined as:

$U_{hat} =\int^{+\infty}_{-\infty} f_l(l)F_s(l) \ dl$

where Uhat is the unreliability of the component, fl(·) the probability density function of the load, and Fs(·) the cumulative density function of the strength.

Note that both the load and strength random variables never take negative values. Since both these random variables are non-negative, the lower limit of the above integral changes. That is, the lower limit changes from -∞ to 0, since fl(·) and Fs(·) will be 0 for negative values (i.e., for l<0). As a consequence, the above integral is given by:

$U_{hat} =\int^{+\infty}_{0} f_l(l)F_s(l) \ dl$

The reliability of the component is Rhat=1-Uhat. Continue reading R code for constructing likelihood based confidence intervals for stress-strength models

## R code for constructing bootstrap confidence intervals for stress-strength models

The following R code may be used for constructing bias-corrected percentile confidence intervals for stress-strength models. These bias-corrected percentile confidence intervals are obtained with a bootstrapping method.

The code focuses at first on a situation in which stress and strength both follow a normal distribution. However, any other combination of distributions may be used in the R code (e.g, having stress follow a lognormal distribution, while strength a Weibull distribution). In fact, it will be demonstrated how to change the code such that the stress and strength both follow a Weibull distribution.

A comprehensive account of bootstrap confidence intervals for stress-strength models is given in Barbiero, A. (2011), Confidence Intervals for Reliability of Stress-Strength Models in the Normal Case, Communications in Statistics – Simulation and Computation, 40, 907-925. Note though that the bootstrap confidence intervals described/reported by Alessandro Barbiero in his 2011 paper are standard (or simple) percentile confidence intervals and not bias-corrected percentile confidence intervals.
Alessandro Barbiero also maintains an R package called StressStrength. However, the package is limited to situations in which stress and strength are both normally distributed.