Assume two independent random variables $X$ and $Y$ with p.d.f. $f(x)$ and $g(y)$. For simplicity, both $X$ and $Y$ are positive. How to find $E[X|X<Y]$?
We know $P(X<Y)=\int_0^\infty\int_0^yf(x)dxg(y)dy$.
Is it true that $E[X|X<Y]=\int_0^\infty\int_0^yxf(x)dxg(y)dy$?
- 51
-
1The last RHS is $E(X;X<Y)$. To get $E(X\mid X<Y)$, simply divide it by $P(X<Y)$, which you already have. – Did Feb 25 '18 at 13:11
-
@Did, how the expectation will change if we need to find $E[X|X<aY]$, where $a$ is constant? – Much Sal Feb 25 '18 at 20:42
-
Again the ratio of two terms, which surely you can write down. – Did Feb 25 '18 at 21:33
1 Answers
In order to calculate $E[X\mid X<Y\ ]$ it is enough if we know the corresponding conditional density. That density can be calculated if the conditional cumulative distribution is known: $$F_{X\mid X<Y\ }(x)=P(X<x\mid X<Y\ )=\frac{P(X<x\ \cap X <Y)}{P( X <Y)}.$$Now,
$$P(X<x\cap X<Y\ )=\int_{-\infty}^{\infty}P(X<x\cap X<Y\mid Y=y\ )g(y)\ dy=$$ $$=\int_{-\infty}^{\infty}P(X<x\cap X<y)g(y)\ dy$$because of independence. Then consider that
$$P(X<x\cap X<y)=\begin{cases}F(x)&\text{ if }&x\leq y\\ F(y)&\text{ if }&y< x.\end{cases}$$
We have then
$$P(X<x\cap X<Y\ )=\int_{-\infty}^xF(y)g(y)\ dy+F(x)\int_x^{\infty}g(y)\ dy=$$ $$=\int_{-\infty}^xF(y)g(y)\ dy+F(x)(1-G(x)).$$
The same way,
$$P(X<Y)=\int_{-\infty}^{\infty}P(X<Y\mid Y=y)g(y)\ dy=$$ $$=\int_{-\infty}^{\infty}P(X<y)g(y)\ dy=\int_{-\infty}^{\infty}F(y)g(y)\ dy.$$
That is, $$F_{X\mid X<Y\ }(x)=\frac{\int_{-\infty}^xF(y)g(y)\ dy+F(x)(1-G(x))}{\int_{-\infty}^{\infty}F(y)g(y)\ dy}.$$
The corresponding conditional density is
$$f_{X\mid X<Y}(x)=\frac{F(x)g(x)+f(x)(1-G(x))-F(x)g(x)}{\int_{-\infty}^{\infty}F(y)g(y)\ dy}.$$
And finally the conditional expectation can be computed.
Example
Let $X$ and $Y$ be independent and both uniformly distributed over $[0,1]$. We have $$P(X<Y)=\int_0^1y\ dy=\frac12,$$
$$f_{X\mid X<Y}(x)=\frac{x\times1+1\times(1-x)-x\times1}{\frac12}=2(1-x)$$ and
$$E[X\mid X<Y]=2\int_0^1 x-x^2 \ dx=\frac13.$$
- 20,452
-
Out of curiosity, is it a coincidence that the distribution of $X|X<Y$ is the same as that of $|X-Y|$ for your example? – StubbornAtom Feb 25 '18 at 12:25
-
-
-
-
Yes. For a (much) shorter route, probably more adapted to the OP's need, see my comment on main. – Did Feb 25 '18 at 13:25
-
@Did: Thank you (also) on behalf of the OP. I do this all the time: going through the most elementary steps -- because my self confidence is very low. (Not joking.) – zoli Feb 25 '18 at 13:29