If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Introduction to residuals

Build a basic understanding of what a residual is.
We run into a problem in stats when we're trying to fit a line to data points in a scatter plot. The problem is this: It's hard to say for sure which line fits the data best.
For example, imagine three scientists, ${\text{Andrea}}$, ${\text{Jeremy}}$, and ${\text{Brooke}}$, are working with the same data set. If each scientist draws a different line of fit, how do they decide which line is best?
If only we had some way to measure how well each line fit each data point...

## Residuals to the rescue!

A residual is a measure of how well a line fits an individual data point.
Consider this simple data set with a line of fit drawn through it
and notice how point $\left(2,8\right)$ is $4$ units above the line:
This vertical distance is known as a residual. For data points above the line, the residual is positive, and for data points below the line, the residual is negative.
For example, the residual for the point $\left(4,3\right)$ is $-2$:
The closer a data point's residual is to $0$, the better the fit. In this case, the line fits the point $\left(4,3\right)$ better than it fits the point $\left(2,8\right)$.

## Try to find the remaining residuals yourself

What is the residual of the point $\left(6,7\right)$ in the graph above?

What is the residual of the point $\left(8,8\right)$ in the graph above?

What is the residual of the point $\left(1,2\right)$ in the graph above?

## Want to join the conversation?

• what is the difference between error and residual?
• I think ysun means that:An error is a deviation from the population mean.A residual is a deviation from the sample mean.
Errors, like other population parameters (e.g. a population mean), are usually theoretical.
Residuals, like other sample statistics (e.g. a sample mean), are measured values from a sample. Sample statistics are often used to estimate population parameters, so in this case the residuals can be used to estimate the error.
• How do you do this On a calculator
• the explanation on how to do this using a calculator is confusing
• This article does not explain what to do with the residuals after calculating them. Are you supposed to sum them? When are you supposed to use them?
• The article is incomplete. It didn't circle back around to answer the question it posed at the beginning: "If each scientist draws a different line of fit, how do they decide which line is best?" Calculating the residuals for each line helps you decide which line best fits the data.
• If you have a really positive residual point that is quite far form the LSRL is that good or bad ? Like what can you say about the residual?
• That would be what is called an "outlier".

It could suggest that the measurement that led to that point was wrong — e.g. The value was 3000, but 30000 got entered by mistake.

Another possibility, especially if there aren't a lot of data points, is that the relationship between the variables is not linear — e.g. an exponential curve might be a better fit....

ADDENDUM: It is also possible that the data is actually very "noisy" (highly variable).
• Really dumb question: Why is it called least squares regression? What does least squares mean?
• The "squares" refers to the squares (that is, the 2nd power) of the residuals, and the "least" just means that we're trying to find the smallest total sum of those squares.

You may ask: why squares? The best answer I could find is that it's easy (minimizing a quadratic formula is easy) and still gives good results.
• how can a residual be one sided? For example in the graphs, would being one sided mean the data points are not scattered?
• In statistics, resids (short for residuals) are the differences between the predicted values and the actual values of the response variable. One-sided residuals can occur when a model is fitted to data with some specific characteristics. A one-sided residual plot is a plot of residual values against the fitted values of the model only for one side of the graph.

For example, a one-sided residual plot can be observed when we have a regression model in which our residuals are constrained to be non-negative. In this case, we may have a one-sided residual plot resulting from the fact that only one side of the graph will have positive residuals, while the other side will have residuals of zero.

In terms of scatterplots, being one-sided does not necessarily mean that the data points are not scattered. The scatter in the data points will still be visible in the one-sided residual plot.
• how can you summarize a residual plot?