MATH 2 • STATISTICS & PROBABILITY

Evaluating Linear Model Fit — I can use scatterplots and residual reasoning to evaluate whether a linear model is appropriate at my level.

Learn how scatterplots and residuals reveal whether a straight line truly captures the story your data tells.

Historical Context & Motivation

Humans have tried to spot patterns in data for centuries, from tracking star positions to recording crop yields. The idea of fitting a straight line through a cloud of data points might seem obvious today, but it took brilliant minds and real-world problems to develop the tools we now use. The method of least squares — the mathematical engine behind linear regression — was born from astronomers trying to predict the orbits of celestial bodies. Once people started drawing lines through data, a natural follow-up question arose: How do we know the line is actually a good fit?

1805
Legendre Publishes Least Squares
French mathematician Adrien-Marie Legendre introduced the method of least squares, providing the first systematic way to fit a line to data by minimizing squared errors.
1809
Gauss Refines the Theory
Carl Friedrich Gauss independently developed least squares and connected it to probability theory, showing that the method was optimal when errors follow a normal distribution.
1885
Galton and Regression
Sir Francis Galton coined the term regression while studying how the heights of children relate to their parents' heights, giving birth to regression analysis.
1900s
Residual Analysis Emerges
Statisticians began systematically examining residuals — the differences between observed and predicted values — as a diagnostic tool to check whether a linear model is truly appropriate.
Today
Modern Data Analysis
Residual plots and scatterplot analysis are standard tools in every statistics course and software package, from spreadsheets to machine learning pipelines.

Today, the central question remains the same one those early statisticians asked: is a straight line really the right model for this data, or is a curve or some other relationship hiding beneath the surface? In this lesson, you will learn to answer that question using scatterplots and residual reasoning.

Core Principles & Definitions

Before you can evaluate whether a linear model fits your data, you need to understand a handful of core ideas. These concepts build on each other: scatterplots let you see the overall shape, a line of best fit summarizes the trend, and residuals reveal what the line misses. Together, they form a powerful toolkit for deciding if a linear model is appropriate.

1

Scatterplot

A graph that displays two quantitative variables as coordinate pairs (x, y). The overall pattern — called the form — can be linear, curved, or show no clear trend.
2

Line of Best Fit (LSRL)

The least-squares regression line is the unique straight line that minimizes the sum of the squared residuals. It is written as ŷ = a + bx.
3

Residual

A residual is the vertical distance between an observed y-value and the predicted ŷ-value: residual = y − ŷ. Positive means the point is above the line; negative means below.
4

Residual Plot

A graph of x-values on the horizontal axis versus residuals on the vertical axis. A random scatter with no pattern suggests a linear model is appropriate.
5

Coefficient of Determination (r²)

The value tells you the percentage of variation in y that is explained by the linear relationship with x. It ranges from 0 to 1.
KEY TAKEAWAY
Think of a line of best fit like a GPS route. The route (the line) gives you the general direction, but you rarely drive exactly on the plotted path — you drift a little left, a little right. The residuals are those small drifts. If the drifts are random and small, the GPS route is a great model. If the drifts form a pattern — say, you keep veering further and further off — then the route itself is flawed and you need a different path.

Visual Explanation — Scatterplot with Residuals

The diagram below shows a scatterplot with a line of best fit drawn through the data. Each vertical dashed segment represents a residual — the gap between where the line predicts a point should be and where the point actually falls. Notice how some residuals are positive (point above the line) and some are negative (point below the line). When these residuals appear randomly scattered, the linear model is doing a good job.

Each cyan dot is an observed data point. The dashed violet line is the LSRL. Green dashed segments show positive residuals (point above the line), and red dashed segments show negative residuals (point below the line). Because the residuals alternate between positive and negative with no obvious pattern, a linear model appears appropriate for this data.

The key observation is that the residuals above bounce randomly between positive and negative values with roughly consistent size. There is no curve, fan shape, or cluster in the residuals. This random scatter is exactly what we hope to see when a linear model is a good fit. In the next section, we will contrast this with what happens when a linear model is not appropriate.

Mathematical Framework

Evaluating linear fit relies on two key mathematical ideas: computing residuals and interpreting the coefficient of determination. Let's define each formula carefully so you can use them in practice.

LEAST-SQUARES REGRESSION LINE
ŷ = a + bx
Here ŷ (read "y-hat") is the predicted value, a is the y-intercept, b is the slope, and x is the value of the explanatory variable.
RESIDUAL
Residual = y − ŷ = y − (a + bx)
The residual is the difference between the observed value (y) and the predicted value (ŷ). A positive residual means the actual value is above the line; negative means it is below.
COEFFICIENT OF DETERMINATION
r² = 1 − (Σ(y − ŷ)² / Σ(y − ȳ)²)
The numerator sums the squared residuals. The denominator sums the squared deviations from the mean ȳ. An r² close to 1 means the line explains most of the variation; close to 0 means it explains very little.
⚠️ Important Caution
A high r² value alone does NOT guarantee a linear model is appropriate. You must always check the residual plot. A curved data set can still produce a high r², but the residual plot will reveal the hidden pattern. Always pair r² with visual diagnostics.

Residual Plots — Good Fit vs. Bad Fit

The most powerful diagnostic tool for evaluating a linear model is the residual plot. You create one by plotting the x-values (or the predicted ŷ-values) on the horizontal axis and the corresponding residuals on the vertical axis. A horizontal line at zero represents the regression line itself. Here are the three patterns you need to recognize.

Three residual plot patterns side by side. The left panel (green border) shows random scatter, indicating a linear model is appropriate. The center panel (red border) shows a curved pattern, meaning a nonlinear model would be better. The right panel (amber border) shows a fan shape, indicating unequal spread (heteroscedasticity).

In summary, when you create a residual plot and see no discernible pattern — just a random cloud of points centered on zero — you can feel confident that a linear model captures the essential relationship in the data. If you see a curve, a fan, or clusters, the linear model is missing something important, and a different model may be needed.

Worked Example — Study Hours vs. Test Score

A teacher collects data on hours studied (x) and test score (y) from eight students. She fits the regression line ŷ = 52 + 5.5x. Let's compute residuals and decide whether a linear model is appropriate.

Data table with computed predicted values and residuals
StudentHours (x)Actual Score (y)Predicted (ŷ)Residual (y − ŷ)
A16057.5+2.5
B26263−1
C37168.5+2.5
D47274−2
E58079.5+0.5
F68385−2
G79290.5+1.5
H89496−2
Evaluating the Linear Model
1
Step 1 — Compute Predicted ValuesFor each student, substitute their x-value into the equation ŷ = 52 + 5.5x. For example, Student A studied 1 hour, so ŷ = 52 + 5.5(1) = 57.5. Repeat for all students to fill the Predicted column.
ŷ values: 57.5, 63, 68.5, 74, 79.5, 85, 90.5, 96
2
Step 2 — Calculate ResidualsFor each student, compute residual = y − ŷ. Student A: 60 − 57.5 = +2.5. Student B: 62 − 63 = −1. Continue for every data point.
Residuals: +2.5, −1, +2.5, −2, +0.5, −2, +1.5, −2
3
Step 3 — Check for PatternsList the signs of the residuals in order: +, −, +, −, +, −, +, −. They alternate without forming a curve or fan. The magnitudes are all between 0.5 and 2.5, so the spread is roughly constant.
No pattern detected — residuals scatter randomly
4
Step 4 — Draw ConclusionBecause the residual plot shows random scatter with no curve, fan, or clustering, and residuals are small relative to the scores, we conclude that a linear model is appropriate for this data. The teacher can confidently use ŷ = 52 + 5.5x to estimate test scores based on study hours.
Linear model IS appropriate ✓

Strengths & Limitations of Linear Models

Linear models are some of the most widely used tools in statistics, but they are not always the right choice. Understanding both their power and their limitations helps you make smarter decisions when analyzing data.

Strengths vs. Limitations of Linear Regression
StrengthsLimitations
Easy to interpret — slope tells you the rate of change, intercept gives the starting valueCannot capture curved relationships (exponential growth, quadratic patterns, etc.)
r² gives a single-number summary of how well the model explains variationA high r² can be misleading if the residual plot shows a clear pattern
Can be computed by hand or with any calculator/spreadsheetSensitive to outliers — a single extreme point can pull the line dramatically
Works well when the true relationship is approximately linear over the observed rangeAssumes constant spread (homoscedasticity) — a fan-shaped residual plot violates this
Provides a foundation for more advanced regression techniquesExtrapolation (predicting far beyond observed data) is risky and often inaccurate
KEY TAKEAWAY
Think of a linear model like a measuring tape — it's perfect for straight edges, but if you try to measure around a curve (like a basketball), you'll get a bad result. Always check the residual plot to make sure your data's shape matches the tool you're using. When it does, the linear model is wonderfully simple and effective. When it doesn't, it's time to reach for a different tool.

Connection to Advanced Modeling

The skills you're building here — analyzing scatterplots and reading residual plots — are the foundation for every type of regression analysis you will encounter in more advanced courses. When a linear model isn't appropriate, statisticians turn to models like quadratic, exponential, or logarithmic regression. The table below shows how the linear approach you know compares to what comes next.

Linear regression vs. advanced modeling techniques
FeatureLinear Regression (This Lesson)Advanced Regression
Model formŷ = a + bx (straight line)ŷ = ax² + bx + c, ŷ = abˣ, ŷ = a + b ln(x), etc.
When to useResidual plot shows random scatterResidual plot shows curves, fans, or systematic patterns
Diagnostic toolResidual plot + r²Residual plot + r² + transformations
ComplexityOne predictor, one outcome, straight lineMultiple predictors, polynomial terms, or variable transformations

In AP Statistics and college courses, you will learn to transform data (for example, by taking logarithms) to straighten a curved relationship, then apply linear regression to the transformed data. This technique works precisely because the residual plot diagnostics you learned here still apply — you just apply them after the transformation. Mastering residual reasoning now sets you up for success with these more powerful methods later.

Practice Problems

PROBLEM 1CONCEPTUAL
A student creates a residual plot and sees all points clustered tightly around the zero line with no visible pattern. What does this tell you about the linear model?
PROBLEM 2BASIC CALCULATION
A regression line is ŷ = 10 + 3x. For a data point where x = 4 and y = 25, compute the residual. Is this point above or below the regression line?
PROBLEM 3INTERMEDIATE
A researcher fits ŷ = 20 + 2x to data and gets the following residuals in order of increasing x: −3, −5, −2, +4, +6, +5, −1, −4. Describe the pattern in the residuals and explain what it suggests about the model.
PROBLEM 4APPLIED
A car dealership models the relationship between a car's age (x, in years) and its resale value (y, in thousands of dollars) with the line ŷ = 28 − 2.5x (r² = 0.91). Data: (1, 26), (2, 23), (3, 19), (5, 13), (7, 9), (10, 5). Compute the residuals and determine whether the linear model is appropriate.
PROBLEM 5CRITICAL THINKING
Two students analyze the same data set. Student A reports r² = 0.95 and concludes the linear model is excellent. Student B creates a residual plot and finds a clear U-shaped curve. Who is right, and what broader lesson does this illustrate about evaluating model fit?

Lesson Summary

Evaluating whether a linear model is appropriate requires more than just computing an equation. You begin by examining a scatterplot to see whether the overall trend appears roughly straight. Then you fit a least-squares regression line (ŷ = a + bx) and calculate residuals (y − ŷ) for each data point. These residuals are plotted against x to create a residual plot, which is the most important diagnostic tool for judging model fit.

A residual plot showing random scatter with no pattern confirms the linear model is appropriate. A curved pattern suggests a nonlinear relationship, and a fan shape indicates unequal spread. Remember that r² alone is not enough — you must always pair it with a visual residual analysis. These skills form the foundation for all future work in regression and data modeling.

Varsity Tutors • Math 2 • Evaluating Linear Model Fit