I am interested in deriving an expression for the probability of a value $X$ being larger than a value $Y$. More specifically: I want to calculate an expression for $P(X>Y|I)$ and I know the probability densities $P(X|I)$ and $P(Y|I)$. The $I$ is some background knowledge I have concerning both variables.

Let us assume that $X$, $Y$ are real-valued and absolutely continuous values in $(x_{min},x_{max})$ and $(y_{min},y_{max})$ respectively. The intervals might be infinite,but do not have to be. Here is what I arrived at (steps shown at the end of the question):

$$P(X>Y|I) = \int_{x_{min}}^{x_{max}} dX \, P(X|I) \int_{y_{min}}^{\min(X,y_{max})} dY \, P(Y|X,I)$$

where the comma (,) notation means a logical and.

My questions

  • Is this expression correct?
  • What other assumptions about my $X$,$Y$ have I made that I am unaware of?

Calculation To arrive at the expression I wrote

\begin{eqnarray}P(X>Y|I) &=& \int_{x_{min}}^{x_{max}} dX \int_{y_{min}}^{y_{max}} dY \, P(X>Y,X,Y|I) \\ &=& \int_{x_{min}}^{x_{max}} dX \, \int_{y_{min}}^{y_{max}} dY P(X>Y|X,Y,I)\cdot P(Y|X,I)\cdot P(X|I) \end{eqnarray} and now I can write $P(X>Y|X,Y,I)=\theta(X-Y)$ where $\theta$ is the step function. From this follows:

$$P(X>Y|I) = \int_{x_{min}}^{x_{max}} dX \, P(X|I) \int_{y_{min}}^{y_{max}} dY \, P(X|I) \cdot \theta(X-Y)\cdot P(Y|X,I) $$

Using the $\theta$ function to constrain the upper integration border, the expression above should follow... I hope.

Notes: Related Question on math/SE

I am aware of this related question on math/SE but I am specifically interested in an expression where $X$,$Y$ need not be independent.

  • $\begingroup$ When it comes to your first question ("Is this expression correct?"), I would say yes. $\endgroup$
    – inmybrain
    Commented Feb 13, 2020 at 7:51

1 Answer 1


If the random variables (conditional) are not necessarily independent, but you know their marginals (conditional on I), you can try to model them using a copula. This has been studied in a Bayesian context in:

Bayesian Inference for $P(X<Y)$ Using Asymmetric Dependent Distributions


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.