MATH 1 • STATISTICS & PROBABILITY

Linear Regression Models — I can fit a linear model (line of best fit) and interpret slope and intercept in context.

Learn how to draw a line through data and use it to make real-world predictions.

Historical Context & Motivation

Humans have always tried to find patterns in data, but for most of history there was no systematic way to draw a "best" line through a cloud of points. Imagine an astronomer in the 1700s recording the positions of a comet night after night — each measurement slightly imperfect due to telescope limitations. How could anyone decide which straight line best summarized those observations? This question drove some of the greatest mathematicians in history to develop what we now call linear regression, a technique that finds the single straight line that fits a set of data points as closely as possible.

1805
Legendre Publishes the Method of Least Squares
French mathematician Adrien-Marie Legendre introduced the least-squares method to minimize errors when fitting a curve to astronomical data.
1809
Gauss Refines the Theory
Carl Friedrich Gauss showed that the least-squares method produces the best estimate when errors follow a normal (bell-curve) distribution, giving it a solid mathematical foundation.
1886
Galton Coins "Regression"
Sir Francis Galton studied the heights of parents and children. He noticed that very tall parents tended to have shorter children, and vice versa — a pattern he called regression toward the mean. The name stuck.
1900s–Today
Regression Goes Digital
With computers, regression became a workhorse of science, economics, medicine, and machine learning. Today it is often the first model anyone fits to a new dataset.

The central question that linear regression answers is deceptively simple: Given a scatter of data points, what single straight line does the best job of summarizing the relationship between two variables? In this lesson you will learn how to find that line, what its slope and y-intercept actually mean in context, and how to use it for predictions.

Core Principles & Definitions

Before you can build a regression model, you need a few foundational ideas. A scatter plot displays pairs of numerical data as points on a coordinate plane, with the explanatory variable (often called the independent variable) on the x-axis and the response variable (dependent variable) on the y-axis. When the points cluster around a line-shaped pattern, we say the data shows a linear association.

1

Line of Best Fit

A straight line drawn through a scatter plot that minimizes the overall distance between the line and every data point. Also called the regression line or least-squares regression line.
2

Slope (b₁)

The amount the predicted y-value changes for every one-unit increase in x. Slope tells you the rate of change in context.
3

Y-Intercept (b₀)

The predicted y-value when x equals zero. It anchors the line vertically. Sometimes the intercept has a practical meaning; sometimes x = 0 is outside the data range and the intercept is just a mathematical starting point.
4

Residual

The difference between an observed y-value and the y-value predicted by the line: residual = observed − predicted. The least-squares line minimizes the sum of the squared residuals.
KEY TAKEAWAY
Think of the line of best fit like a tightrope stretched across a crowd. The rope can't touch every person's head, but it's positioned so it's as close as possible to everyone on average. The slope tells you whether the rope tilts uphill or downhill, and the y-intercept is where the rope meets the wall.

Visual Explanation — The Scatter Plot and Line of Best Fit

The diagram below shows a scatter plot of data relating hours studied (x-axis) to test score (y-axis) for 10 students. The regression line is drawn through the data, and the vertical dashed segments illustrate residuals — the gaps between observed and predicted scores.

Each cyan dot is a student's actual data point. The purple line is the regression line ŷ = 52 + 4.8x. The amber dashed segments show residuals — the vertical distances between observed and predicted values.

Notice how the line doesn't pass through every point — it doesn't need to. The line is positioned so the total of all the squared residuals is as small as possible. Points above the line have positive residuals (the student scored better than predicted), and points below the line have negative residuals (the student scored lower than predicted). This balance is the heart of the least-squares criterion.

Mathematical Framework

The regression line has the familiar form of a linear equation. We write it with a "hat" on y to show it represents a predicted value rather than an observed one.

REGRESSION LINE EQUATION
ŷ = b₀ + b₁x
ŷ = predicted value of the response variable, b₀ = y-intercept (value of ŷ when x = 0), b₁ = slope (change in ŷ per one-unit increase in x), x = value of the explanatory variable.

The formulas for slope and intercept use the means and standard deviations of x and y, along with the correlation coefficient r, which measures the strength and direction of the linear relationship.

SLOPE FORMULA
b₁ = r × (s_y / s_x)
r = correlation coefficient (−1 ≤ r ≤ 1), sy = standard deviation of y, sx = standard deviation of x.
INTERCEPT FORMULA
b₀ = ȳ − b₁ × x̄
x̄ = mean of x-values, ȳ = mean of y-values. This guarantees the regression line passes through the point (x̄, ȳ).
RESIDUAL
residual = y − ŷ
y = observed value, ŷ = predicted value. Positive residuals mean the observed value is above the line; negative residuals mean it is below the line.
📝 Important Note
You will often use a calculator or software to compute b₀ and b₁. The key skill at this level is interpreting the slope and intercept in the context of the problem, not just computing them.

Interpreting Slope and Intercept in Context

Computing the numbers is only half the job. The real power of regression lies in explaining what those numbers mean in the real-world situation you are analyzing. The diagram below illustrates how slope and intercept map onto a concrete scenario — predicting the cost of a phone plan based on gigabytes of data used.

The y-intercept ($25) represents the base monthly fee when no data is used. The slope ($4.50 per GB) shows the cost increase for each additional gigabyte.

Template Sentences for Interpretation

When you interpret slope on a test or assignment, use language like: "For each additional [unit of x], the predicted [y] increases (or decreases) by [slope value] [units of y]." For the intercept, say: "When [x] is 0, the predicted [y] is [intercept value] [units of y]." Always mention whether the intercept makes practical sense. If nobody in the dataset had an x-value near zero, then the intercept is an extrapolation and may not be meaningful in context.

Summary of regression components with real-world meaning
ComponentWhat It Tells YouExample (Phone Plan)
Slope (b₁)Rate of change — how much ŷ changes per one-unit increase in xEach additional GB of data costs an extra $4.50 per month
Intercept (b₀)Starting value — predicted ŷ when x = 0The base monthly fee is $25 when no data is used
ŷ (prediction)Predicted value for a specific xA user consuming 6 GB is predicted to pay 25 + 4.5(6) = $52

Worked Example — Ice Cream Sales vs. Temperature

A shop owner tracks the daily high temperature (°F) and the number of ice cream cones sold over 8 days. After entering the data into a calculator, the owner obtains: x̄ = 75 °F, ȳ = 120 cones, sx = 10 °F, sy = 30 cones, and r = 0.92. Find the regression equation and interpret slope and intercept.

Finding and Interpreting the Regression Line
1
Step 1 — Calculate the Slope (b₁)Use the slope formula: b₁ = r × (sy / sx) = 0.92 × (30 / 10) = 0.92 × 3 = 2.76.
b₁ = 2.76 cones per °F
2
Step 2 — Calculate the Y-Intercept (b₀)Use the intercept formula: b₀ = ȳ − b₁ × x̄ = 120 − 2.76 × 75 = 120 − 207 = −87.
b₀ = −87 cones
3
Step 3 — Write the Regression EquationPutting it together: ŷ = −87 + 2.76x, where x is temperature in °F and ŷ is the predicted number of cones sold.
ŷ = −87 + 2.76x
4
Step 4 — Interpret the SlopeFor each additional degree Fahrenheit increase in the daily high temperature, the predicted number of ice cream cones sold increases by about 2.76 cones.
5
Step 5 — Interpret the InterceptThe model predicts −87 cones when the temperature is 0 °F. This does not make practical sense — you cannot sell a negative number of cones, and 0 °F is far outside the range of the data. The intercept is simply the mathematical anchor of the line; it should not be given a real-world interpretation in this scenario.
6
Step 6 — Make a PredictionPredict sales on an 85 °F day: ŷ = −87 + 2.76(85) = −87 + 234.6 = 147.6. The model predicts about 148 cones sold.
ŷ ≈ 148 cones

Strengths and Limitations of Linear Regression

Linear regression is one of the most widely used statistical tools, but like any model, it has boundaries. Understanding when it works well — and when it doesn't — will keep you from drawing flawed conclusions.

When linear regression works well and when to be cautious
Strengths ✓Limitations ✗
Easy to compute and interpret — the slope gives a clear rate of change.Only captures straight-line patterns. Curved data requires a different model.
Makes predictions within the range of the data (interpolation).Extrapolation (predicting outside the data range) can be wildly inaccurate.
The line always passes through the mean point (x̄, ȳ), keeping predictions centered on the data.Outliers can pull the line dramatically off course.
Correlation coefficient r tells you direction and strength of the relationship.Correlation does not imply causation — a strong line does not prove x causes y.
⚠️ KEY TAKEAWAY
Think of a linear regression model like a GPS route calculated between two cities. The route is reliable as long as you stay on the mapped highway (within the data range). But if you try to keep driving straight past your destination (extrapolation), you might end up in a lake. Always check that your prediction falls within the range of x-values you actually observed.

Connection to Advanced Models

The simple linear regression you learn in Math 1 is the foundation for a whole family of more powerful techniques. As you move into AP Statistics, college courses, or data science, you'll encounter models that build directly on these ideas.

How simple linear regression connects to more advanced statistical modeling
ConceptWhat You Learn NowWhere It Goes Next
Number of VariablesOne explanatory variable (simple linear regression)Multiple explanatory variables (multiple regression)
Shape of FitStraight line onlyCurves — quadratic, exponential, logarithmic regression
Goodness of FitCorrelation coefficient rCoefficient of determination r², residual plots, standard error
Prediction ConfidencePoint prediction (a single ŷ)Prediction intervals (a range of plausible values)

Even machine-learning models used in fields like self-driving cars and medical diagnosis trace their roots back to fitting lines through data. Mastering slope, intercept, and residuals now gives you the vocabulary and intuition to tackle those more complex models later.

Practice Problems

PROBLEM 1CONCEPTUAL
A regression line has the equation ŷ = 40 − 3x, where x is the number of absences from class and ŷ is the predicted final exam score. In your own words, explain what the slope of −3 means in this context.
PROBLEM 2BASIC CALCULATION
A dataset has x̄ = 10, ȳ = 50, sx = 4, sy = 12, and r = 0.8. Calculate the slope b₁ and the y-intercept b₀ of the least-squares regression line.
PROBLEM 3INTERMEDIATE
Using the regression equation ŷ = 26 + 2.4x from Problem 2, predict ŷ when x = 15. Then suppose the actual observed y-value at x = 15 is 58. Calculate the residual and state whether the model over-predicted or under-predicted.
PROBLEM 4APPLIED
A city transportation department fits a regression line to data on daily rainfall (inches) and the number of bus riders: ŷ = 8500 + 1200x. Interpret the slope and intercept in context. A staff member predicts the number of riders on a day with 10 inches of rain. Explain why that prediction might be unreliable, given the data ranged from 0 to 3 inches.
PROBLEM 5CRITICAL THINKING
Two students fit regression lines to the same scatter plot. Student A gets ŷ = 10 + 5x with r = 0.95, and Student B gets ŷ = 30 + 2x with r = 0.60. Student B argues that her line is better because the intercept is higher and closer to the data's center. Evaluate both claims and explain which model is likely a better fit and why.

Lesson Summary

A linear regression model fits a line of best fit (ŷ = b₀ + b₁x) through a scatter plot by minimizing the sum of the squared residuals. The slope (b₁) tells you how much ŷ changes for each one-unit increase in x — it is the rate of change in context. The y-intercept (b₀) is the predicted y-value when x = 0, though it may not always have a practical meaning. To calculate these values you use b₁ = r × (s_y / s_x) and b₀ = ȳ − b₁ × x̄, and the line always passes through the point (x̄, ȳ).

Always interpret slope and intercept in context — connect the numbers to what x and y actually represent. Be cautious with extrapolation (predicting outside the data range), watch out for outliers that can distort the line, and remember that a strong correlation does not prove causation. Mastering these ideas prepares you for more advanced topics like multiple regression, non-linear models, and the coefficient of determination r².

Varsity Tutors • Math 1 • Linear Regression Models — I can fit a linear model (line of best fit) and interpret slope and intercept in context.