Difference between E(Y) and E(Y|X) in regression In linear regression, we postulate a model for estimating $E(Y|X)= \beta_0 + \beta_1 x$
We also propose $Y= \beta_0 + \beta_1 x + \mu$ where μ is an error team with expectation equal to zero. We also assume $X$ are fixed, i.e. not random.
If we replace the first equation into the second, it will result:
$$Y=E(Y|X) + \mu$$
If we take expectation:
$$E(Y) = EE(Y|X) + E(\mu)$$
The first sumand is E(Y) by the law of iterated expectation. The second is 0 by assumption. So we have:
$$E(Y)=E(Y)$$ which is correct.
But if we directly took expectation in the second equation without replacing, it yields:
$$E(Y) = \beta_0 + \beta_1 x + E(\mu)$$
since $\beta_0 + \beta_1 x$ are not random. So it results:
$$E(Y)= \beta_0 + \beta_1 x \equiv E(Y|X)$$
So we finally arrive to $E(Y) = E(Y|X)$ which is not correct.
What's the explanation about this contradiction? When am I being wrong? Thank you in advance

If $X$ is not random (i.e. just some constant), then $E[Y|X] = E[Y]$ so it is correct. If $X$ was random then $E[Y] = \beta_0 + \beta_1 E[X] + E[\mu]$ and so, $E[Y|X]$ would not be equal to $E[Y]$ in general
