Consider the standard linear regression model given by

$Y = XB + \varepsilon$.

$E[Y\mid X] = XB$ if $E[\varepsilon \mid X] = 0$.

We say that the conditional expectation function is a random variable because $X$ is a random variable. But in econometrics textbooks I also read "with non-stochastic regressors, or conditional on $X$..." When we condition on $X$ in $E[Y\mid X] = XB$, is $X$ constant or not? If it is, why is the conditional expectation function a random variable?

$E[Y\mid X = x]$ would be constant not $E[Y\mid X]$, because in the latter we do not consider realisations of $X$ while in the former we do. So what do we mean by that "conditional on $X$ is treating $X$ as constant?

I paste one paragraph from the econometrics book: "If the regressors can be treated as nonstochastic, as they would be in an experimental situation in which the analyst chooses the values in X, then the sampling variance of the least squares estimator can be derived by treating X as a matrix of constants. Alternatively, we can allow X to be stochastic, do the analysis conditionally on the observed X, then consider averaging over X as we did in obtaining (4-6) from (4-5)."

I read this as follows. If X is treated as constant, then there is no need to condition on X. If X is treated as random, then do the derivations conditional on X. So conditioning on X does not mean that X is treated as constant. So does E[Y|X] mean that X is constant? No. X is random, and we just condition on the random X. Conditioning on X does not make X constant. Or am I missing something?


The two scenarios exist. From wiki:

Depending on the nature of the conditioning, the conditional expectation can be either a random variable itself or a fixed value.

  • If the experimenter cannot control the values of $X$ (the majority of cases in observational studies), the conditional expectation is a random variable because it is a function of a random variable (i.e. $X$).

  • If the experimenter can control the $X$, $\mathbb{E}(Y\mid X)$ is no longer a random variable because $X$ is known.

Notice being known is different from being observed, after all you can observe realisations of a random variable. This might help get a better grasp of these two cases.

  • $\begingroup$ Could you elaborate more on "being known is different from being observed"? Maybe the answer I am looking for is lying here. Basically, I am just trying to understand what conditioning on X means in E[Y|X]. Does conditioning on X make X observed, known, constant? X is a random variable. Why would conditioning on X make X constant. It seems my confusion is about the definitions. $\endgroup$ – Snoopy Feb 12 '19 at 20:55
  • $\begingroup$ "Does conditioning on X make X observed, known, constant?": The nature of X is not changed when you use it as condition in the expectation. If it's a random variable, it will still a random variable, if it's fixed/known/constant it will stay that way. It is its nature that defines whether E(Y|X) will be a random variable or not. Does this clear things for you? $\endgroup$ – Lucas Farias Feb 12 '19 at 21:11
  • $\begingroup$ Also, being known means X is formed by values that cannot change; fixed values. This cannot be the case if X is a random variable, by its very definition a random variable cannot be described as a fixed value. Thus it would make no sense to say it's 'known'. Nonetheless, you can observe realisations of a random variable. Think of it this way: Your age is a fixed value, you cannot change it. On the other hand, the flip of a coin is a random variable, until you observe a realisation of it, you can't tell whether its heads or tails $\endgroup$ – Lucas Farias Feb 12 '19 at 21:28

You're correct to say that $E[Y|X]$ is a random variable while $E[Y|X=x]$ is just a constant, as you mentioned in your last paragraph. However, $E[Y|X]$ notationally means "Tell me the expectation of Y when you know X". Conditioned on X, given X etc. all mean the same. So, $X$ is treated as constant inside this expectation because, you pretend as if you have/know it, and the whole idea is based around that fact. In general, you really have your data matrix, $X$, and fit a regression model.

  • $\begingroup$ But this is what I am asking. If we condition on X, then X is constant. Then why the conditional expectation function is random still? $\endgroup$ – Snoopy Feb 12 '19 at 19:58
  • $\begingroup$ It is assumed constant inside the expectation, since it is assumed to be known while calculating the expectation of $Y$. But, once calculated, the resulting expression (outside the expectation) becomes random since it contains $X$. I don't know how to put it differently. It seems you don't benefit from the answer, I'll be happy to delete it if this persists :). Before closing, I think the mechanics resembles differentiating (or integrating) multi-variate functions. While calculating $\partial f / \partial x$, we assume $y$ to be constant, but it is actually not. $\endgroup$ – gunes Feb 12 '19 at 20:05
  • $\begingroup$ If I am not benefiting from your answer, it is probably that I do not understand it. In the first place, E[Y | X] is random because we condition on the random variable X. So does conditioning mean that X is constant? No because I can condition on a random variable. Right? But the textbook reads "nonstochastic regressors, or conditional on X, ..." So what does this mean? $\endgroup$ – Snoopy Feb 12 '19 at 20:18
  • $\begingroup$ Conditioning does not make X nonstochastic. But the excerpt suggests that it does. So when I see E[Y | X], why should I conclude that X is nonstochastic? It is not. Does conditioning make X constant? No, because I can condition on a random variable. So what does "nonstochastic regressors, or conditional on X, ..." mean? Should not it read "nonstoshastic regressors, or conditional on the realised sample values of X"? $\endgroup$ – Snoopy Feb 12 '19 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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