Linearity of maximum function in expectation I was solving an exercise for a probability theory course and stumbled upon the following problem.
Given a continuous random variable $X$, and $\max(a,b) = a$ if $a > b$ and $b$ otherwise, is
$$
E[\max(X, 0)] = \max(E[X], 0)
$$
true in general?

Some calculations give, for $X$ a random variable with density $f(x)$ and cdf $ \DeclareMathOperator{\E}{\mathbb{E}} F(x)$
\begin{align}
   \E \max(X,0) &= \int_{-\infty}^\infty \max(x,0) f(x) \; dx \\
                &= \int_{-\infty}^0 0 \cdot f(x)\; dx + \int_0^\infty x \cdot f(x)\; dx \\
                &= \int_0^\infty x \cdot f(x)\; dx
\end{align}
Now, the conditional distribution of $X$ given $X \ge 0$ has density
$\frac{f(x)}{1-F(0)}$ (for $x\ge 0$, zero elsewhere) so find that
\begin{align}
\E \max(X,0) &= \int_0^\infty x \cdot f(x)\; dx \\
             &= \left[ 1-F(0)  \right] \cdot \int_0^\infty x \cdot \frac{f(x)}{1-F(0)}  \; dx \\
  &= \left[ 1-F(0)  \right] \cdot \E\left[ X \mid X \ge 0  \right]
\end{align}
while $\max( \E X, 0)$  will be zero for any random variable with negative expectation.
So any random variable which can take both negative and positive values with positive probability, and which has a negative expectation, gives you an counterexample.
