2. Exploring Two-Variable Data

Linear Regression Models

Linear Regression Models 📈

Introduction: Why do lines matter in data?

students, imagine trying to predict how many hours a student studies from their test score, or how much a car costs from its mileage. In both cases, two numerical variables may be related, and one of the most useful tools in AP Statistics is a linear regression model. A linear regression model helps us describe the relationship between two quantitative variables with a straight line and use that line to make predictions.

Learning objectives

By the end of this lesson, students, you should be able to:

  • explain the main ideas and terminology behind linear regression models,
  • apply AP Statistics reasoning to interpret a regression line,
  • connect regression to scatterplots, correlation, and residuals,
  • summarize how regression fits into exploring two-variable data,
  • use evidence from data to judge whether a linear model is reasonable.

Linear regression is not just about drawing a line. It is about seeing patterns, measuring how well the line fits, and understanding when a straight-line model works well and when it does not. That is a big part of exploring bivariate quantitative data. 😊

What a linear regression model does

A linear regression model describes the relationship between an explanatory variable $x$ and a response variable $y$ using a line of the form

$$\hat{y} = a + bx$$

Here, $\hat{y}$ means the predicted value of $y$, $a$ is the $y$-intercept, and $b$ is the slope. In AP Statistics, $x$ is often called the explanatory variable because it may help explain changes in $y$, while $y$ is the response variable because it responds to changes in $x$.

Think of predicting a student’s score $\hat{y}$ from hours studied $x$. If the model is

$$\hat{y} = 60 + 5x,$$

then the predicted score starts at $60$ when $x = 0$, and the model adds about $5$ points for each additional hour studied. This does not mean every student’s score will fit perfectly. It means that, on average, the line gives a useful summary of the pattern.

A key idea is that the regression line is the best-fitting line in the sense that it minimizes the sum of the squared residuals. That makes it different from simply drawing a line by eye. The statistical method behind this is called least squares regression.

Scatterplots: the first step before regression

Before fitting a regression line, students, always look at a scatterplot. A scatterplot shows paired data $(x, y)$ for two quantitative variables. It helps you see whether the relationship is linear, curved, strong, weak, positive, or negative.

Here are some patterns you might see:

  • Positive association: as $x$ increases, $y$ tends to increase.
  • Negative association: as $x$ increases, $y$ tends to decrease.
  • Linear pattern: the points cluster around a straight line.
  • Nonlinear pattern: the points follow a curve or other shape.
  • Outliers: points far from the rest of the data.

For example, suppose a school surveys students and records the number of hours they sleep $x$ and their reaction time $y$. A scatterplot may show that more sleep is associated with faster reaction times. If the points form a roughly straight pattern, then a linear regression model may be reasonable.

A very important AP Statistics idea is that a regression line should only be used when a linear model makes sense. If the scatterplot shows a curve, forcing a line can hide the real pattern. That is why graphs come before formulas. 📊

The regression line and how to interpret it

The regression equation is usually written as

$$\hat{y} = a + bx.$$

Each part has a clear meaning:

  • $a$ is the predicted value of $y$ when $x = 0$.
  • $b$ is the slope, which tells how much $\hat{y}$ changes for each increase of 1 unit in $x$.

If $b > 0$, the line rises from left to right. If $b < 0$, it falls from left to right. The slope has units, too. If $x$ is measured in hours and $y$ in points, then $b$ has units of points per hour.

Example: suppose a model for car value is

$$\hat{y} = 24000 - 1800x,$$

where $x$ is thousands of miles driven. The slope $-1800$ means that for each additional thousand miles, the predicted value drops by about $1800$. That is a real-world statement you can explain in words, not just a number to memorize.

Be careful with the intercept $a$. Sometimes $x = 0$ is meaningful, but sometimes it is not. For example, predicting a car’s value at $0$ thousand miles might be reasonable, but predicting a person’s height at $0$ years old may not be helpful if the model was built using teenagers and adults only. The intercept should be interpreted only when it makes sense in context.

Residuals: the key to judging fit

A residual tells us how far an actual data point is from the regression line. It is defined as

$$\text{residual} = y - \hat{y}.$$

If the residual is positive, the actual value is above the line. If the residual is negative, the actual value is below the line. If the residual is close to $0$, the prediction was very accurate.

Example: if a student’s actual test score is $88$ and the regression model predicts $83$, then the residual is

$$88 - 83 = 5.$$

That means the student scored $5$ points above the predicted value.

Residuals matter because they show how well the line fits each point. A good linear model usually has residuals that are small and randomly scattered around $0$. If residuals show a pattern, that is a warning sign that the relationship may not be linear.

A residual plot is a graph of residuals versus $x$ or versus $\hat{y}$. In a good linear fit, the residual plot should look random, with no obvious curve or pattern. If it curves, the linear model may be missing an important shape in the data. ⚠️

Correlation and regression: connected but not the same

Another major AP Statistics idea is the relationship between correlation and regression. The correlation coefficient, often written as $r$, measures the direction and strength of a linear relationship between two quantitative variables.

Important facts about $r$:

  • $-1 \le r \le 1$,
  • $r$ near $1$ means a strong positive linear relationship,
  • $r$ near $-1$ means a strong negative linear relationship,
  • $r$ near $0$ means little or no linear relationship.

Correlation helps describe the scatterplot, but it does not give a prediction equation by itself. Regression goes further by creating a line for prediction.

Also, correlation does not mean causation. If two variables are related, one does not automatically cause the other. For example, ice cream sales and sunburns may be positively associated in summer, but buying ice cream does not cause sunburns. A hidden variable, such as hot weather, may explain both. That idea is important whenever you use a linear model.

The strength of a regression fit is often summarized by the coefficient of determination, written as $r^2$. It tells the proportion of variation in $y$ explained by the linear relationship with $x$. If $r^2 = 0.81$, then about $81\%$ of the variation in $y$ is explained by the model. The remaining variation is due to other factors and random scatter.

When is a linear regression model appropriate?

students, not every data set should be modeled with a line. A good model should satisfy several practical checks:

  • the scatterplot should show a roughly linear pattern,
  • the association should be fairly strong,
  • there should not be major outliers that distort the line,
  • residuals should show random scatter with no clear pattern.

A strong linear model is especially useful when you want to predict values within the range of the data. Predicting outside the observed range is called extrapolation, and it can be risky because the pattern may change beyond the data you collected.

Example: if a model is based on student ages $13$ to $18$, using it to predict outcomes for a $30$-year-old may not be reasonable. Even a very good line can fail when used too far beyond the original data.

This is why AP Statistics emphasizes context. A model must make sense mathematically and practically. A line is useful only if it matches the story the data are telling. 🧠

How linear regression fits into exploring two-variable data

Linear regression is one part of the larger AP Statistics topic of exploring two-variable data. First, you compare or display data, then you look for patterns, and finally you use a model if one is appropriate.

For quantitative variables, the path often looks like this:

  1. Make a scatterplot.
  2. Describe the association.
  3. Check whether a linear model is reasonable.
  4. Fit a regression line.
  5. Interpret slope, intercept, residuals, and correlation.
  6. Use the model carefully for prediction.

This process connects directly to earlier ideas such as variability, correlation, and the shape of a scatterplot. It also prepares you for later statistical reasoning because you learn to judge models using data, not guesswork.

In real life, linear regression is used in many places: predicting gas mileage from vehicle weight, estimating exam scores from study time, and comparing body temperature changes over time. The exact variables change, but the AP Statistics reasoning stays the same.

Conclusion

Linear regression models give us a powerful way to describe and predict relationships between two quantitative variables. The regression line $\hat{y} = a + bx$ summarizes a linear pattern, while residuals show how far data points are from the line. Correlation measures how strong and how straight the relationship is, and $r^2$ tells how much variation the model explains. Most importantly, students, a regression model should be used with evidence from a scatterplot and residuals, not just because a formula exists.

When you understand linear regression, you are doing more than drawing lines. You are learning how statisticians use data to recognize patterns, make predictions, and check whether a model is trustworthy. That is a major skill in Exploring Two-Variable Data. ✅

Study Notes

  • A linear regression model uses a line $\hat{y} = a + bx$ to predict a response variable $y$ from an explanatory variable $x$.
  • The slope $b$ tells how much the predicted value changes for each 1-unit increase in $x$.
  • The intercept $a$ is the predicted value when $x = 0$, but it should only be interpreted when that makes sense.
  • A scatterplot should be checked before using regression.
  • Residuals are found by $y - \hat{y}$.
  • A good linear model has residuals that are small and randomly scattered around $0$.
  • The correlation coefficient $r$ measures the direction and strength of a linear relationship.
  • The coefficient of determination $r^2$ gives the proportion of variation in $y$ explained by the linear model.
  • Correlation does not imply causation.
  • Extrapolation beyond the observed data range can be unreliable.

Practice Quiz

5 questions to test your understanding

Linear Regression Models — AP Statistics | A-Warded