What's a real life example of a case in which the conditional expectation and unconditional expectation differ? My questions are


*

*We have one variable, is called, "a" and mean of "a" is 5664.


is this  unconditional mean ?



*

*When we regress b on a (dependent is a, independent is b)


Mean Dependent Var is 5664

And when conditional mean is different from unconditional mean ? Can you explain with concrete sample ?
 A: Consider the population of human heights. The unconditional mean is some number. The mean of height of adults, so conditioned on the subject being an adult, is taller.
A: The first way in which these things always differ is that the conditional mean is a function of the conditioning value, whereas the unconditional mean is single value.  If you take any two random variables $L$ and $R$ then the conditional mean is a function of the form $\mu_{L|R}(r) \equiv \mathbb{E}(L|R=r)$ whereas the unconditional mean is a single value $\mu_L \equiv \mathbb{E}(L)$.  These are related by the law of total expectation:
$$\mu_L = \int \limits_\mathscr{R} \mu_{L|R}(r) p_R(r) dr.$$
If you would like an example where the value of the conditional mean is very different from the value of the unconditional mean, just take any two strongly correlated variables $L$ and $R$, and then condition on a value in the extremes of their range.
For example, suppose we take a random person in the world, and let $L$ and $R$ be the respective lengths of that person's left leg and right leg.  Now, consider the difference between the unconditional mean of $L$ (i.e., the mean length of a left leg) versus the conditional mean of $L$ if $R$ is small (i.e., the unconditional mean length of the left leg for a person with a short right leg).
A: Conditional expectation is a function, and expectation is a constant. So the answer is easy: whenever that function is not a constant function.
More details: Let $X,Y$ be random variables and we are interested in the conditional expectation of $Y$ given that $X=x$, where $x$ is a variable ranging over the range of $X$. Write
$$ \DeclareMathOperator{\E}{\mathbb{E}}
   f(x) = \E \left[ Y \mid X=x\right]
$$
The only way we can have $f(x) = \E Y$ is when $f(x)$ is a constant function, for instance, if $X$ and $Y$ are independent.
