Confidence interval for the slope
A confidence interval for the slope of the estimated regression line tells how confident we can be that the true parameter falls within this interval.
As we recall, a confidence interval is a plausible interval of values for a population parameter and tells what degree of confidence we can have that the parameter is included in this interval. For example, a conclusion on a 95% confidence interval can be that we can be 95% confident that the true parameter lies within the interval 2 to 3.
Procedure calculating confidence interval for the slope
In the following I will use an example where we explore the relationship between persons height and their size of gloves in a given geographical area. This is a self-made dataset and serves only as an example.
Start by visualizing
Like in other statistical disciplines, we should start by plotting data to obtain an immediate overview. But first, let’s display the X and Y values in a spreadsheet with the related calculations:
The graph of the line including the line equation indicates a strong relationship between X and Y with a coefficient of determination (r2) of 89%:
Checking the conditions
The quantile-quantile plot indicates that the residuals indeed are normally distributed. The residual plot reveals no difference in variance or curvature, so the Y values seem to be randomly independent variables with equal variance for all X values.
As the conditions for inference seem to be met, we proceed with the inferential statistics doing a confidence interval
The questions to be answered
These calculations are all embedded in statistical software and the graph above automatically gave us the regression line expression including the intercept, slope, and coefficient of determination (r2). But in this example, we work through the formulas by hand.
As the graph above shows, the slope of our estimated regression line is 4.4002 so it seems to be greater than zero and thus, there seems to be a relationship between X and Y. If we wish to express this in mathematical terms, we can conduct a confidence interval answering questions like:
- How sure can we be that the true slope of the true population parameter really is 4.4002?
- Would there be a risk that it really is zero and thus that there is no relationship between height and glove size?
We will state a 95% confidence interval for the slope to answer these questions. That means that we will calculate an interval for which we can be 95% confident that the true value of the slope lies within.
The formula of confidence interval for the slope
The confidence interval is calculated in a similar structure as we know from confidence intervals in other statistical disciplines. It takes the estimated value (the slope in this case) and add and subtract the margin of error:
In Standard errors of the slope I run through the formulas and calculations of the SE and it can also be derived via the spreadsheet above.
Deriving and calculating (s => SE => CI)
Calculation of the SE of the slope (β̂1) and of our confidence interval for the slope:
Where the 2.160 is the given critical t-value for (15-2) 13 degrees of freedom. So, our answer to the question is: We can be 95% confident that the true value of the slope lies between 3.486 and 5.315.
Confidence interval on the slope in MS Excel
Some of my preferred learning material for learning on confidence interval for the slope:
- Econometrics with R, by Christoph Hanck, Martin Arnold, Alexander Gerber and Martin Schmelzer (bookdown text format): Confidence intervals for regression coefficients
- Katie Ann Jager (video: 5:32): Calculating a Confidence interval for the slope by hand
- JBstatistics (video 6:56): Inference on the slope (the formulas)
- JBstatistics (video 7:00): Inference on the slope (an example)
- Khan Academy (video 7:12): Introduction to inference about slope in linear regression
- Khan Academy (video 7:12): An example: Confidence interval for the slope or a regression line
Freelance Data Analyst
+34 616 71 29 85
Spain: Ctra. 404, km 2, 29100 Coín, Malaga
Denmark: c/o Musvitvej 4, 3660 Stenløse
Drop me a line
What are you working on just now? Can I help you, and can you help me?
Learning statistics. Doing statistics. Freelance since 2005. Dane. Living in Spain. With my Spanish wife and two children.
Connect with me
What they say
20 years in sales, analysis, journalism and startups. See what my customers and partners say about me.