# Probability one Weibull is less than another, given upper-bound

I have two random variables $X$ and $Y$, representing times-to-event, drawn from Weibull distributions. When $Y$ occurs, then $X$ cannot occur after that. Aside from this, we can assume independence. Importantly, we don't actually observe $Y$-events, only $X$-events.

(If it's helpful to make this more concrete: let's say $X$-events are some activity of an organism, while $Y$ events represent whether that organism has died. Obviously after a death-event, no more activity can occur. But for whatever reason, we can't directly observe deaths: we want to infer them based on [lack of] activity.)

At time $t$, I haven't observed any $X$-events. I want to calculate the probability that this is due to a $Y$-event having occurred. I believe this is the probability that both the following are true: (1) a $Y$-event occurred before the current time $t$, and (2) a $Y$-event occurred before an $X$-event could occur.

We can get (1) with the cumulative distribution function for the Weibull distribution:

$$P(Y<t) = 1-exp(-(t/\lambda_Y)^{k_Y})$$

Where $k_Y$ and $\lambda_Y$ are the parameters of $Y$'s distribution.

However, I'm having trouble with (2), which (I think) is:

$$P(Y<X|X<t, Y<t)$$

I'm struggling not only in deriving $P(X>Y)$, but also in accounting for the conditional (i.e., we are only interested in the probability that the $Y$-event happens before the $X$-event given that we only wait up to t).

• This sounds like a case where you really need a Bayesian approach. Commented Mar 13, 2017 at 22:27
• Ironically, I am asking this question because I need to know the likelihood, so that I can code it in Stan. If you could give guidance on how I could implement it in a probabilistic programming language, I would definitely find that an acceptable answer. Commented Mar 13, 2017 at 22:44

OK, I have made some progress.

The solution for this general kind of problem is described in this post:

https://math.stackexchange.com/questions/396386/finding-an-expression-for-the-probability-that-one-random-variable-is-less-than

Assume for simplicity that $X$ and $Y$ have respectively density functions $f_X(x)$ and $f_Y(y)$. Then $$\Pr(X\lt Y|Y\lt k)=\frac{\Pr((X\lt Y)\cap (Y\lt k)}{\Pr(Y\lt k))}.$$ Both numerator and denominator can be expressed as integrals. For the numerator, we want $\int_{y=0}^k\int_{x=0}^y f_X(x)f_Y(y)\,dx\,dy$.

I need to modify this a bit to get my $P(Y<X|X<t, Y<t)$, since there are two conditions. But first, I think the harder part is the numerator. The PDF for the Weibull distribution is

$$\nu \lambda x^{\nu-1}\text{exp}(-\lambda x^\nu)$$

(This is the PH parameterization. I had trouble doing the next step with the AFT parameterization.) I plug this into the 'numerator' from the other post, then plug that into Wolfram Mathematica:

FullSimplify[Integrate[(v*L*x^(v - 1)*Exp[-(L*x^v)])*(n*M*y^(n - 1)*Exp[-(M*y^n)]), {x, 0, U}, {y, 0, y}], L > 0 && M > 0 && n > 0 && v > 0] 

This gives:

$$\text{exp}(-\lambda_1 x^\nu_1 -\lambda_2 y^\nu_2) * (-1+\text{exp}(-\lambda_1 x^\nu_1))*(-1+\text{exp}(-\lambda_2 y^\nu_2))$$

So I now have the numerator. To get the denominator, I just use the CCDF of the Weibull distribution:

$$P(X<t) \cap P(Y<t) = \text{exp}(-\lambda_1 t^{\nu_1})) * \text{exp}(-\lambda_2 t^{\nu_2}))$$

So I think dividing the first equation by the second will give me what I want. I'd like run some simulations to confirm that I haven't made any errors, but I believe I've arrived at my solution.