I understand that $E(Y|X)$ and $E(Y)$ are different, but difference sources, when $Y$ is a function of other random variables such as $X$, use $Y|X$ and $Y$ to describe this relationship. I'm not sure if this is a notational thing, but does something like $Y|X = m(X) + \epsilon$ and $Y = m(X) + \epsilon$ (in the context of modelling $Y$ with some function of $X$ plus random noise) have different interpretations? Assuming $X,Y,\epsilon$ are random variables.


2 Answers 2


There is actually no such object as $Y|X$ --- whenever this notation appears, it is an abuse of notation which operates as shorthand for specifying the conditional distribution of a random variable conditional on another random variable.$^\dagger$ Thus, the statement $Y|X = m(X) + \epsilon$ actually doesn't make any sense; the conditionality notation $|X$ is used only in the context of stipulating the distribution of a random variable, not its functional relationship to other random variables. In a regression model, you would always say $Y = m(X) + \epsilon$, not $Y|X = m(X) + \epsilon$.

When you are referring to the distribution of either $Y$ or $\epsilon$, you could refer either to the marginal distribution or the conditional given $X$. In the context of regression analysis, analysis is done conditional on the explanatory variable $X$, and so it would be usual to refer to the distribution conditional on this. The notation $Y|X$ operates as shorthand for specifying a conditional distribution. For example, the statement:

$$Y|X \sim \text{N}(m(X), \sigma_\epsilon^2),$$

is actually shorthand for the conditional distribution:

$$p(Y=y|X=x) = \text{N}(y|m(x),\sigma_\epsilon^2).$$

$^\dagger$ Strictly speaking, it is possible to create a new object $Y|X$ which is a mapping from the range $\mathscr{X}$ to a set of random variables on different probability spaces, each conditional on the stipulated value of $X$. In most cases we do not want to bother with this, since the notation is just used as a shorthand for stipulating a conditional distribution.

  • $\begingroup$ An example of $Y|X$ appears at the bottom of page 12, I assume I can ignore the "$|X$" in this case? In general, $Y|X$ should only occur in the context of referencing a conditional probability density or mass function for $Y$ given $X=x$? $\endgroup$
    – Yandle
    Mar 10, 2020 at 3:00
  • $\begingroup$ Yes, I would just ignore it. $\endgroup$
    – Ben
    Mar 10, 2020 at 3:17

In my opinion, the use of the equality makes dependence on $X$ explicit. The only place I have seen notation like $y \vert X$ is when the distribution of $y$ is being discussed. You see this frequently in Bayesian models like

$$ y\vert \mu , \sigma \sim \mathcal{N}(\mu, \sigma) $$

This notation tells me that there is a prior for $\sigma$ and that the distribution of $y$ depends on whatever $\sigma$ is drawn from the data generating process.

In any case, I don't see much difference between $y = $ and $y\vert X = $.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.