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

Residual plots | Exploring bivariate numerical data | AP Statistics | Khan Academy


4m read
·Nov 11, 2024

What we're going to do in this video is talk about the idea of a residual plot for a given regression and the data that it's trying to explain.

So right over here we have a fairly simple least squares regression. We're trying to fit four points. In previous videos, we actually came up with the equation of this least squares regression line. What I'm going to do now is plot the residuals for each of these points.

So what is a residual? Well, just as a reminder, your residual for a given point is equal to the actual minus the expected. So how do I make that tangible? Well, what's the residual for this point right over here? For this point here, the actual y when x equals 1 is one. But the expected when x = 1 for this least squares regression line, 2.5 * 1 - 2, well that's going to be 0.5.

And so our residual is 1 minus 0.5. So we have a positive 0.5 residual. Over for this point, you have zero residual; the actual is the expected. For this point right over here, the actual when x equals 2 for y is two, but the expected is three.

So our residual over here, once again, the actual is Y = 2 when x = 2; the expected 2 * 2.5 - 2 is 3. So this is going to be 2 - 3, which equals a residual of -1. And then over here, our residual, our actual when x = 3 is 6. Our expected when x = 3 is 5.5, so 6 minus 5.5, that is a positive 0.5.

So those are the residuals. But how do we plot it? Well, we would set up our axes. Let me do it right over here: one, two, and three. And let's see, the maximum residual here is 0.5 and then the minimum one here is -1.

So let's see, this could be 0.5, 1, 1.5. So this is -1, this is positive one here. And so when x equals 1, what was the residual? Well, the actual was one, expected was 0.5. 1 - 0.5 is 0.5. So this right over here we can plot right over here; the residual is 0.5.

When x equals 2, we actually have two data points. First I'll do this one: when we have the point (2, 3), the residual there is zero, so for one of them, the residual is zero.

Now for the other one, the residual is -1. Let me do that in a different color. For the other one, the residual is negative one, so we would plot it right over here. And then this last point, the residual is positive 0.5, so it is just like that.

And so this thing that I have just created where we're just seeing for each x where we have a corresponding point, we plot the point above or below the line based on the residual, this is called a residual plot.

Now one question is why do people even go through the trouble of creating a residual plot like this? The answer is, regardless of whether the regression line is upward sloping or downward sloping, this gives you a sense of how good a fit it is and whether a line is good at explaining the relationship between the variables.

The general idea is if you see the points pretty evenly scattered or randomly scattered above and below this line, you don't really discern any trend here; then a line is probably a good model for the data. But if you do see some type of trend, if the residuals had an upward trend like this or if they were curving up and then curving down or they had a downward trend, then you might say, "Hey, this line isn't a good fit," and maybe we would have to do a nonlinear model.

What are some examples of other residual plots? And let's try to analyze them a bit. So right here you have a regression line and its corresponding residual plot. And once again, you see here the residual is slightly positive; the actual is slightly above the line, and you see it right over there, it's slightly positive.

This one's even more positive; you see it there. But like the example we just looked at, it looks like these residuals are pretty evenly scattered above and below the line. There isn't any discernible trend, and so I would say that a linear model here, and in particular this regression line, is a good model for this data.

But if we see something like this, a different picture emerges. When I look at just the residual plot, it doesn't look like they're evenly scattered. It looks like there's some type of trend here I'm going down here, but then I'm going back up.

When you see something like this where on the residual plot you're going below the x-axis and then above, then it might say, "Hey, a linear model might not be appropriate," maybe some type of nonlinear model, some type of nonlinear curve might better fit the data or the relationship between the y and the x is nonlinear.

Another way you could think about it is when you have a lot of residuals that are pretty far away from the x-axis in the residual plot, you would also say this line isn't such a good fit. If you calculate the R value here, it would only be slightly positive, but it would not be close to one.

More Articles

View All
Example: Intersection of sine and cosine | Graphs of trig functions | Trigonometry | Khan Academy
We’re asked at how many points did the graph of y equals sine of theta and y equal cosine theta intersect for theta between 0 and 2 pi, and it’s 0 is less than or equal to theta, which is less than or equal to 2 pi. So, we’re going to include 0 and 2 pi, …
Introduction to electron configurations | AP Chemistry | Khan Academy
In a previous video, we’ve introduced ourselves to the idea of an orbital. Electrons don’t just orbit a nucleus the way that a planet might orbit a star, but really, in order to describe where an electron is at any given point in time, we’re really thinki…
Comparing fractions with the same denominator | Math | 3rd grade | Khan Academy
Let’s compare ( \frac{2}{4} ) and ( \frac{3}{4} ). First, let’s think about what these fractions mean. ( \frac{2}{4} ) means we have some whole and we’ve split it into four equal size pieces, and we get two of those pieces. Maybe we could think about pizz…
The Power of Suggestion
[dramatic music playing] [Michael] This is McGill University in Montreal, Canada. It boasts an enrollment of more than 40,000 students from 150 countries. The campus employs 1,700 professors teaching 300 programs of study, and it’s proud to be home to 12…
BEST IMAGES OF THE WEEK: IMG! episode 5
The cheapest way to make your own swimming pool and a bus who thinks he’s the Kool-Aid man. It’s episode five of IMG. We begin the day with hoodies that zip up to make you look like Captain America, a ninja, Batman, or Boba Fett. Last week, BuzzFeed gave…
Zero-order reactions | Kinetics | AP Chemistry | Khan Academy
Let’s say we have a hypothetical reaction where reactant A turns into products. Let’s say the reaction is zero order with respect to A. If it’s zero order with respect to A, we can write that the rate of the reaction is equal to the rate constant k times …