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.

confidence interval summing two random variables quantiles

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

R code for constructing likelihood based confidence intervals when summing two random variables

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 probability of failure when X+Y is less than, say, 314 seconds? This probability (denoted by Fhat) is computed using the following (convolution) integral:

F_{hat} =\int^{+\infty}_{-\infty} F_x(314-y)f_y(y) \ dy

where Fx(·) is the Weibull cumulative density function (cdf) of X (=onset time), and fy(·) is the Weibull probability density function (pdf) of Y (=growth time).

Note that both the onset times (X) and growth times (Y) never take negative values. Since both these random variables X and Y are non-negative, the limits of the above integral will change. That is, the lower limit changes from ∞ to 0, since fy will be 0 for negative values (i.e., for y<0). Similarly, the upper limit changes from ∞ to 314 since Fx(314-y) will be 0 for negative values (i.e., for y>314). Accordingly, the above integral is given by:

F_{hat} =\int^{314}_{0} F_x(314-y)f_y(y) \ dy

Continue reading R code for constructing likelihood based confidence intervals when summing two random variables