When I analyzed a data set with two categories, I used a dummy variable $z=1$ for category 1, and 0 otherwise, and added the extra term $\beta z$ to the regression model. Suppose the least squares estimate for $\beta$ is $b$. I tried to calculate some prediction intervals for the two categories. For category 1, since $z=1$, I needed to count the variance for $b$, but for category 2, since $z=0$, I did not count this variance. It then appeared that the variance for category 1 includes an additional variance because I happened to code it as $z=1$. I am new to study econometrics. Could anyone please help with this puzzle? Am I missing anything here?


1 Answer 1


That is natural and you are not missing anything.

Let $y=\alpha + \beta z + u$. Your prediction of $y$ given $z=1$ is $\hat{y} = a + b$, where $a$ and $b$ are the OLS estimates. The prediction error ($y - \hat{y}$) for $z=1$ is, thus, $(\alpha - a) + (\beta-b) + u$, which is involved with $b$. On the other hand, for $z=0$, the prediction of $y$ is $a$ and the prediction error is $(\alpha-a) + u$, which has nothing to do with $b$. As you said, the former depends on $b$, while the latter does not. (Perhaps it would help to remember that the value of $z$ is given for the prediction, and thus the prediction intervals depend on the value of $z$.)

(Calculation of the prediction intervals:) You can calculate the prediction intervals using the formula $(a+b) \pm se((\alpha-a)+(\beta-b)+u) \cdot \textit{critical value}$ for $z=1$, and the formula $a \pm se((\alpha-a)+u) \cdot \textit{critical value}$ for $z=0$. which is fine. Note that these two prediction intervals can also be written as $(a+b) \pm se(a+b+u) \cdot cv$ and $a\pm se(a+u) \cdot cv$, respectively, because $\alpha$ and $\beta$ are constant (nonrandom). How to estimate the standard errors can be found in Wooldridge's textbook (the "Prediction and Residual Analysis" section; 6.4 in 5ed).

  • $\begingroup$ Thanks for your answer. The counter-intuitive part for me is that the category with $z=1$ always has the extra variance due to the variance of $b$, which means a wider prediction interval (i.e., we are less sure where a new observation falls). Thus, we are less sure about a new observation in category 1, if we code category 1 as $z=1$, and less sure about category 2 otherwise. It seems that this inference depends on how we code the dummy variable, instead of the nature of the problem. If we change the coding, we obtain different intervals, then which intervals should we use? Thanks. $\endgroup$
    – Justin
    Jul 16, 2017 at 15:10
  • $\begingroup$ That's an interesting point, but it won't happen. If you define $w=1-z$ and regress $y$ on $w$ instead of on $z$, then $\alpha$ and $\beta$ change, $a$ and $b$ change, and the standard errors change, and in the end the prediction interval for $w=0$ is exactly the same as what you originally obtained for $z=1$. Also $a+b$ doesn't have to have a larger variance than $a$ when they are mutually (strongly negatively) correlated. $\endgroup$
    – chan1142
    Jul 16, 2017 at 15:16
  • $\begingroup$ Thanks a lot. This answers my question. I missed the point that $a$ and $b$ in general are not independent. $\endgroup$
    – Justin
    Jul 16, 2017 at 20:20

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.