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.

Math 2 emblem with a variable, a triangle, and a ruler.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

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.

SECTION 2

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 r² 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.

SECTION 3

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.

Scatterplot with Line of Best Fit & Residualsx (independent variable)y (dependent variable)ŷ = a + bx−17−28+30+13−18+25−25+30−20Positive residual (above line)Negative residual (below line)
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.

SECTION 4

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

y^=a+bxŷ = 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^=y−(a+bx)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

r2=1−(Σ(y−y^)2/Σ(y−yˉ)2)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.

SECTION 5

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✓ Random Scatter0Linear model IS appropriate✗ Curved Pattern0Linear model is NOT appropriate✗ Fan Shape0Unequal spread (heteroscedasticity)What to Look For in a Residual Plot✓ Good Fit:• Points scattered randomly above and below the zero line• No obvious pattern (no curve, no fan, no clusters)• Roughly equal spread across all x-values✗ Bad Fit:• U-shape or arch → data is curved, not linear• Fan/cone shape → spread changes with x (unequal variance)• Clear clusters → possible subgroups in data
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.

SECTION 6

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.

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

Data table with computed predicted values and residuals

Evaluating the Linear Model

  1. 1

    Step 1 — Compute Predicted Values

    For 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. 2

    Step 2 — Calculate Residuals

    For 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. 3

    Step 3 — Check for Patterns

    List 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. 4

    Step 4 — Draw Conclusion

    Because 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 ✓

SECTION 7

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.

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

Strengths vs. Limitations of Linear Regression

✦

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.

SECTION 8

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.

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

Linear regression vs. advanced modeling techniques

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.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

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?
Show answer
A residual plot with points randomly scattered near zero indicates that the linear model is a good fit for the data. The model's predictions are consistently close to the actual values, and there is no systematic error (no curve, fan, or clustering). This means the relationship between x and y is well-described by a straight line, and the linear model is appropriate to use for predictions within the observed range of x.

Question 2: BASIC 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?
Show answer
First, compute the predicted value: ŷ = 10 + 3(4) = 10 + 12 = 22. Then calculate the residual: residual = y − ŷ = 25 − 22 = +3. Since the residual is positive, the actual data point (y = 25) is above the regression line's prediction (ŷ = 22). On a scatterplot, this point would sit 3 units above the line.

Question 3: INTERMEDIATE

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.
Show answer
The residuals start negative (−3, −5, −2), become positive in the middle (+4, +6, +5), and return to negative (−1, −4). This U-shaped or curved pattern is a strong signal that the data has a nonlinear (likely curved) relationship. Even though a line was fit to the data, the residual plot reveals that a linear model is NOT appropriate. The line systematically underestimates in the middle of the x-range and overestimates at the ends, suggesting a quadratic or other curved model would be more suitable.

Question 4: APPLIED

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.
Show answer
First, compute predicted values: ŷ(1) = 25.5, ŷ(2) = 23, ŷ(3) = 20.5, ŷ(5) = 15.5, ŷ(7) = 10.5, ŷ(10) = 3. Residuals: 26 − 25.5 = +0.5, 23 − 23 = 0, 19 − 20.5 = −1.5, 13 − 15.5 = −2.5, 9 − 10.5 = −1.5, 5 − 3 = +2. The residuals go positive, zero, then negative, then back toward positive — a subtle curved pattern suggesting the car's value may decrease faster early on and slow later (exponential decay). Despite the high r² of 0.91, the residual pattern hints that a linear model may not be the best choice, and an exponential model could fit better.

Question 5: CRITICAL 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?
Show answer
Student B is correct that the linear model is not appropriate, despite the high r². This scenario illustrates a critical lesson in statistics: r² alone is never sufficient to validate a linear model. A high r² tells you that the line captures a large proportion of the total variation, but it does not tell you whether the remaining variation is randomly distributed. The U-shaped residual plot reveals that the errors are systematic, meaning a curved model would better capture the true relationship. This example underscores why you must always pair numerical summaries (like r²) with visual diagnostics (like residual plots). Relying on a single statistic can lead to overconfidence in a flawed model.

SUMMARY

Lesson Summary

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