# 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
– Macro Jun 30 '12 at 19:16
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

1
– cardinal Jun 30 '12 at 21:06

## 2 Answers

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.

-

3
– 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).

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9060838222503662, "perplexity_flag": "head"}