## Does $X\le Y$ imply $\mathbb{E}[X|Z]\le \mathbb{E}[Y|Z]$

Let $$X, Y, Z$$ be random variables. If $$X\le Y$$, I wonder if $$\mathbb{E}[X|Z=z]\le \mathbb{E}[Y|Z=z]$$ holds.

I have a contradiction between math and intuition.

First, math. I think math shows that this inequality is correct. Since $$X\le Y$$, we have $$X-Y\le 0$$. Then, $$\mathbb{E}[X-Y|Z=z]=\sum_{x,y} (x-y)p(X=x,Y=y|Z=z)$$ Since $$x-y\le0$$ and $$p(x,y|z)\ge0$$, it is clear that $$\mathbb{E}[X-Y|Z=z]\le0$$ which implies $$\mathbb{E}[X|Z=z]\le \mathbb{E}[Y|Z=z]$$.

Second, intuition. Intuitively, the inequality is incorrect. For example, it is possible that when $$Z=z$$, the possibility to have $$Y=y$$ is zero for all $$y$$. And it is possible that $$\mathbb{E}[X|Z=z]$$ is positive. In this case, the inequality does not hold.

Is the intuition wrong? or the math wrong? I searched a bit and found a note saying that the inequality holds almost surely. I don’t understand why it is almost surely.

Posted on Categories proxies