Linear Regression
Models
Learn to fit a line of best fit to data, then interpret the slope and intercept to make predictions in real-world contexts.
What Is Linear Regression?
Linear regression is a statistical method for finding the straight line that best describes the relationship between two numerical variables. Given a set of data points, regression finds the line \( \hat{y} = mx + b \) that minimizes the overall distance from every point to the line.
Scatter Plots and Patterns
Why Regression Matters
Linear regression turns raw data into a predictive tool. Once we have the equation of the line, we can:
The Line of Best Fit Equation
The "hat" on \( \hat{y} \) reminds us this is a prediction, not an observed value. The line minimizes the sum of squared vertical distances (residuals) from each point to the line.
Interpreting the Slope
Slope is the rate of change: \( m = \dfrac{\text{rise}}{\text{run}} = \dfrac{\Delta y}{\Delta x} \). A positive slope means \( y \) increases as \( x \) increases; a negative slope means \( y \) decreases.
Interpreting the Y-Intercept
Always check: does \( x = 0 \) make sense in context? If the data only covers \( x \)-values from 10 to 50, the intercept may be extrapolation and not practically meaningful.
Correlation vs. Causation
The Correlation Coefficient \( r \)
The value \( r \) measures the strength and direction of a linear relationship. It always satisfies \( -1 \leq r \leq 1 \).
How to Find the Line of Best Fit
Example 1: Study Hours
A teacher collects data on hours studied and exam scores for 8 students. The regression equation is:
Example 2: Temperature and Sales
A store tracks daily high temperature (\( x \), in \(^{\circ}\text{F}\)) and hot chocolate sales (\( y \), in cups). The regression output gives:
Example 3: Residuals
A residual is the difference between the observed value and the predicted value: \( \text{residual} = y - \hat{y} \).
Interpolation vs. Extrapolation
Common Mistakes
Summary Table
| Component | Symbol | Interpretation |
|---|---|---|
| Slope | \( m \) | Change in \( \hat{y} \) per unit change in \( x \) |
| Y-Intercept | \( b \) | Predicted \( y \) when \( x = 0 \) |
| Correlation | \( r \) | Strength and direction (\( -1 \) to \( 1 \)) |
| Coefficient of Determination | \( r^2 \) | Fraction of variation in \( y \) explained by model |
| Residual | \( y - \hat{y} \) | Error for a single data point |
| Predicted Value | \( \hat{y} \) | Value the line gives for a given \( x \) |
Question 1 of 5
A regression model for predicting test scores from hours of sleep is \( \hat{y} = 4.2x + 38 \). What does the slope of \( 4.2 \) mean in context?
Question 2 of 5
If a regression equation is \( \hat{y} = -2.5x + 100 \), and the data ranges from \( x = 5 \) to \( x = 30 \), which prediction is extrapolation?
Question 3 of 5
A data set has \( r = -0.85 \). Which statement is true?
Question 4 of 5
The regression equation \( \hat{y} = 3x + 20 \) predicts \( \hat{y} = 50 \) when \( x = 10 \). A student actually scores \( y = 56 \). What is the residual?
Question 5 of 5
In the equation \( \hat{y} = 0.75x + 12 \), the y-intercept of \( 12 \) represents: