# Variance of a predicted $y$ when $x_0$ is given? [duplicate]

I cannot figure out why the variance of a prediction of $y$, when given $x_0$ is

$$\sigma^2\bigg(1+\frac 1 n +\frac{(x_0-\bar x)^2}{Sxx}\bigg)$$

Isn't this the variance of a prediction error?

I'm thinking that

$${\rm Var}(\widehat{y_0})\ne{\rm Var}(\widehat{y_0}-y_0)$$

since one involves an error term and one does not. It would be amazing if any of you and show me the proof of this variance! Thanks

• while you posted your question under the regression tag, you should stil add your actual prediction model, otherwise your question can not be answered accurately. moreover this seems to be a homework problem. assuming ols: you are right, the prediction $\hat{y}_0$ and the error of the prediction, $\hat{y}_0-y_0$ are two different things. However, the variance of both expressions will involve the error term, since your least square estimates are based on $y_i$. For the calculation you just plug in the formulas of your ols-estimates. – chRrr Apr 17 '18 at 8:55