yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Confidence interval for the slope of a regression line | AP Statistics | Khan Academy


5m read
·Nov 11, 2024

Musa is interested in the relationship between hours spent studying and caffeine consumption among students at his school. He randomly selects 20 students at his school and records their caffeine intake in milligrams and the amount of time studying in a given week. Here is a computer output from a least squares regression analysis on his sample. Assume that all conditions for inference have been met. What is the 95 percent confidence interval for the slope of the least squares regression line?

So if you feel inspired, pause the video and see if you can have a go at it. Otherwise, we'll do this together.

Okay, so let's first remind ourselves what's even going on. So let's visualize the regression. Our horizontal axis, or our x-axis, would be our caffeine intake in milligrams, and then our y-axis, or our vertical axis, that would be the, I would assume it's in hours, so time, time studying. Musa here, he randomly selects 20 students, and so for each of those students, he sees how much caffeine they consumed and how much time they spent studying and plots them here.

There will be 20 data points: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20. He inputs these data points into a computer in order to fit a least squares regression line, and let's say the least squares regression line looks something like this. A least squares regression line comes from trying to minimize the square distance between the line and all of these points.

This is giving us information on that least squares regression line. The most valuable things here, if we really want to help visualize or understand the line, are what we get in this column. The constant coefficient tells us essentially what is the y-intercept here: 2.544. And then the coefficient on the caffeine, this is one way of thinking about, well, for every incremental increase in caffeine, how much does this time studying increase? You might recognize this as the slope of the least squares regression line.

So this is the slope, and this would be equal to 0.164. Now, this information right over here tells us how well our least squares regression line fits the data. R squared, you might already be familiar with it, says how much of the variance in the y variable is explainable by the x variable. If it was 1 or 100, that means all of it could be explained and it's a very good fit. If it was 0, that means none of it can be explained, and it'll be a very bad fit.

Capital S, this is the standard deviation of the residuals, and it's another measure of how much these data points vary from this regression line. Now, this column right over here is going to prove to be useful for answering the question at hand. This gives us the standard error of the coefficient, and the coefficient that we really care about, the statistic that we really care about, is the slope of the regression line.

This gives us the standard error for the slope of the regression line. You could view this as the estimate of the standard deviation of the sampling distribution of the slope of the regression line. Remember, we took a sample of 20 folks here, and we calculated a statistic, which is the slope of the regression line. Every time you do a different sample, you will likely get a different slope, and this slope is an estimate of some true parameter in the population. This would sometimes also be called the standard error of the slope of the least squares regression line.

Now, these last two columns you don't have to worry about in the context of this video. This is useful if you were saying, "Well, assuming that there is no relationship between caffeine intake and time studying, what is the associated t statistic for the statistics that I actually calculated? And what would be the probability of getting something that extreme or more extreme, assuming that there is no association, assuming that, for example, the actual slope of the regression line is zero?" And this says, well, the probability, if we would assume that, is actually quite low. It's about a one percent chance that you would have gotten these results if there truly was not a relationship between caffeine intake and time studying.

But with all of that out of the way, let's actually answer the question. Well, to construct a confidence interval around a statistic, you would take the value of the statistic that you calculated from your sample, so 0.164, and then it would be plus or minus a critical t value. This would be driven by the fact that you care about a 95 percent confidence interval and by the degrees of freedom, and I'll talk about that in a second.

Then you would multiply that times the standard error of the statistic, and in this case, the statistic that we care about is the slope. So this is 0.057 times 0.057. The reason why we're using a critical t value instead of a critical z value is because our standard error of the statistic is an estimate. We don't actually know the standard deviation of the sampling distribution.

So the last thing we have to do is figure out what is this critical t value. You can figure it out using either a calculator or using a table. I'll do it using a table, and to do that we know what the degrees of freedom are. When you're doing this with a regression slope like we're doing right now, your degrees of freedom are going to be the number of data points you have minus 2.

So our degrees of freedom are going to be 20 minus 2, which is equal to 18. I'm not going to go into a bunch of depth right now—it actually is beyond the scope of this video for sure—as to why you subtract 2 here. But just so that we can look it up on a table, this is our degrees of freedom. We care about a 95 confidence level that's equivalent to having a two and a half percent tail on either side.

Our degrees of freedom is 18, so our critical t value is 2.101. Thus, our 95 percent confidence interval is going to be 0.164 plus or minus our critical t value, 2.101, times the standard error of the statistic—which I’ll just put in parentheses, 0.057.

You could type this into a calculator if you wanted to figure out the exact values here, but the way to interpret a 95 confidence interval is that 95 of the time that you calculate a 95 confidence interval, it is going to overlap with the true value of the parameter that we are estimating.

More Articles

View All
Does it really matter what browser I choose?
So Kelly, we have several different options on what type of browser we use. Does it matter from a safety and privacy point of view? Yeah, there are a couple factors that you might wanna think about that make a browser potentially safer. So one thing that…
Extraneous solutions | Equations | Algebra 2 | Khan Academy
In this video, we’re going to talk about extraneous solutions. If you’ve never heard the term before, I encourage you to review some videos on Khan Academy on extraneous solutions. But just as a bit of a refresher, it’s the idea that you do a bunch of leg…
WHACK REBECCA BLACK! .. and more: DONG!
Vsauce. Today on my subway ride into work, I earned the very final star I needed in Angry Birds. But I know what you’re thinking. “Michael, I don’t care. I want things I can do online now, gosh!” DONG. Let’s begin with Leanback. That’s right, there’s a …
Aliens Would Visit for Knowledge, Not Resources
I think Stephen Hawking himself said that it was a mistake to broadcast radio waves out into the universe because the aliens are going to be out there, and they’re going to be like conquistadors, and they’re going to want to take over our planet for their…
Overcoming Self-Hatred
Self-hatred is something I’ve struggled with a lot in the past, so this video is quite personal. The experience of self-hatred often goes together with depression and is basically a mechanism to cope with beliefs about oneself and our position in the grea…
Animal behavior and offspring success | Middle school biology | Khan Academy
Let’s talk a little bit about reproductive success, which is related to the number of surviving offspring that an animal has during its lifetime. An animal that has more surviving offspring has a higher reproductive success. Now, there’s two broad categ…