# Calculating the confidence interval for simple linear regression coefficient estimates

I have a data set of paired measurements $(x_1,y_1),(x_2,y_2),...,(x_n,y_n)$. I need to fit a linear regression line $y=ax+b$ to this data. Therefore, I have to estimate the parameters $a$ and $b$.

How can I then calculate the confidence interval for these estimated parameters?

I referred to the wiki article which says http://en.wikipedia.org/wiki/Simple_linear_regression:

Normal assumption

Under the first assumption above, that of the normality of the error terms, the estimator of the slope coefficient will itself be normally distributed with mean $\beta$ and variance $\sigma^2/\sum(x_i-\bar > x)^2$.

I didn't get how this formula was derived.

-
If this is homework, please tag it as such. – JohnRos Jun 30 '12 at 19:05
I referred to the wiki article. But I didn't get some of the stuff. I have reposted in the question – user34790 Jun 30 '12 at 19:59
– cardinal Jun 30 '12 at 21:06

Under normality assumptions for the error term in the model the formulas for the least squares estimates are:
$\beta_0=\bar{y}-\beta_1\bar{x}$ (where $\bar{x}$ is the mean of the $x_i$s and $\bar{y}$ is the mean of the $y_i$s) and $\beta_1=(\sum x_iy_i-n\bar{x}\bar{y})/(\sum x_i^2-n\bar{x}^2)$.

Both $\beta_0$ and $\beta_1$ are then normally distributed and when divided by their estimated standard deviations have t distributions under the null hypothesis that the true value is 0. Given this you can construct confidence intervals based on the t distribution.

-
+1. Michael, given your many expert contributions on this site, it would help users if you would learn and use mathjax so that your answers are easier to read and follow. You can infer a lot about how it works by looking at the edits people have made on your answers. You can also see how any expression on CV was produced by right-clicking on it and then selecting 'Show Math As' -> 'TeX Commands'. I have also found this to be a very comprehensive reference (albeit slow to load). Thanks again. – gung Jul 1 '12 at 15:04

How are you fitting the regression equation? Knowing that will help us to help you.

If you are doing the regression by hand, then use the formula in the book that gave you the formula for the regression (or use the wikipedia article in the comments above). Or better yet, get a real statistical software package to help you.

If you are using Excel or another spreadsheet then you should really switch to a real statistics program.

If you are using a statistics program then it may have an option or command that will compute the interval for you (but we don't know what program you are using, so we can't tell you what that command is). Even if the software does not compute the interval for you, it may give you the proper standard errors that you just need to multiply by the proper table value and add and subtract from the coefficient estimate (that formula should be in your textbook or on the wikipedia article).

-