# Regression Confidence interval in terms of standard errors of the parameters

In simple linear regression, I know the confidence interval can be calculated from:

$CI = t\sqrt{\frac{\sigma^2}{n}+\frac{(x-\bar{x})^2\sigma^2}{\sum{(x-\bar{x})^2}}}$

I know this equation comes from the relation $Y=\bar{Y} +\beta_1(x-\bar{x})$

Is there a way to either use Matrix Algebra to calculate this from the Standard Error matrix?

$\sigma^2(X'X)^{-1}$ where $\sigma^2 = \frac{SS_e}{\nu}$ and degrees of freedom $\nu = n-2$

I'm looking for a way to extend the confidence interval to multiple linear regression, including polynomial x.

• Didn't you find anything when searching our site? Try multiple regression confidence interval – whuber Aug 17 '16 at 14:45
• I see lots of R code, but no generalizations. – Kevin Nowaczyk Aug 17 '16 at 14:53
• Here's the closest I could come in my search: Rob Hyndman's formula for a prediction interval at stats.stackexchange.com/a/9144/919. A value of $1$ is mysteriously added in--that accounts for the prediction uncertainty. If you were to leave that out, you would have a confidence interval. For details, consult any textbook on multiple regression. – whuber Aug 17 '16 at 14:56
• It's not mysterious, the prediction interval has an extra 1 to account for the fact the we are predicting future values of $Y$, vs the value of $\hat{Y}$ in the confidence interval. Something like: $V(Y) = V(\hat{Y}) + \sigma^2$ – Kevin Nowaczyk Aug 17 '16 at 15:15
• Isn't that what I wrote? :-) But since you clearly understand that point, you will be able to use Hyndman's post effectively. – whuber Aug 17 '16 at 15:19