Linear Regression and Correlation - Complete Interactive Lesson
Part 1: Scatterplots & Describing a Relationship
📈 Linear Regression and Correlation
Part 1 of 5 — Scatterplots & Describing a Relationship
Topics in This Part
| Section |
|---|
| Bivariate Data & Scatterplots |
| Direction, Form, and Strength |
| Explanatory vs. Response Variables |
🔑 Key Concept: When two numerical variables are measured on the same individuals — like hours studied and test score — we plot the pairs as points. The picture that emerges (a scatterplot) tells us whether the variables move together, and how tightly.
Bivariate Data & Scatterplots
Bivariate means two variables. Each individual contributes an ordered pair .
| Hours studied () | Test score () |
|---|---|
| 1 | 50 |
| 2 | 65 |
| 3 | 70 |
| 4 | 80 |
| 5 | 90 |
Plotting these five points gives a scatterplot. Here the points climb from lower-left to upper-right — more hours tends to mean a higher score.
We always put the explanatory variable (the one we think does the explaining) on the horizontal -axis and the response variable (the one we think responds) on the vertical -axis.
💡 In "hours studied vs. test score," hours is explanatory () and score is response (). Ask yourself: which one would I change to affect the other? That one is .
Concept Check 🎯
Direction, Form, and Strength
Describe every scatterplot with three words:
- Direction — Positive (points rise left-to-right) or negative (points fall).
- Form — Linear (points follow a straight-line pattern) or nonlinear (a curve).
- Strength — How tightly the points hug the pattern: strong, moderate, or weak.
| Picture | Direction | Form | Strength |
|---|---|---|---|
| Points rise tightly along a line | Positive | Linear | Strong |
| Points fall in a loose cloud | Negative | Linear | Weak |
| Points trace a U-shape | (curved) | Nonlinear | — |
⚠️ Always look at the scatterplot first. Everything else in this lesson — the correlation coefficient, the line of best fit — only makes sense when the form is linear. A strong curved pattern can fool a number into looking weak.
Describe the Scatterplot 🔽
A scatterplot of outdoor temperature vs. ice cream sales shows points climbing steadily from lower-left to upper-right, clustered tightly around a straight line.
Negative Relationships
A negative relationship is just as common: as one variable goes up, the other goes down, so the points fall from upper-left to lower-right.
| Explanatory () | Response () | Likely direction |
|---|---|---|
| Hours of TV watched | Test grade | Negative |
| Outdoor temperature | Heating bill | Negative |
| Age of a used car | Resale price | Negative |
| Hours exercised | Resting heart rate | Negative |
💡 A negative relationship can still be strong — strength is about how tightly the points hug the line, not which way the line tilts. A tightly falling cloud of points is strong and negative.
Concept Check 🎯
Why This Matters
Once we know a relationship is linear, two powerful tools open up:
- The correlation coefficient — a single number measuring direction and strength (Part 2).
- The line of best fit — an equation that lets us predict (Parts 3–4).
You can now read a scatterplot and describe it in three words. Next we turn "strong/moderate/weak" into an exact number.
Part 2: The Correlation Coefficient r
📈 Linear Regression and Correlation
Part 2 of 5 — The Correlation Coefficient
🔑 The Idea: The correlation coefficient squeezes the direction and strength of a linear relationship into one number between and .
What Tells You
- The sign of = the direction. Positive → positive (rising) trend; negative → negative (falling) trend.
- The size of (its distance from ) = the strength.
| Value of | Meaning |
|---|---|
| Perfect positive line (every point on it) | |
| Perfect negative line | |
| No linear relationship | |
| Strong | |
| Moderate | |
| Weak |
💡 is stronger than . Strength depends on how far is from , not on its sign. The sign only tells direction.
Concept Check 🎯
Computing by Hand
For a small data set you can compute from sums of squares:
and , .
Worked Example
Data: and . Means: , .
| 0 | 1 | 4 | 4 | 4 | ||
| 1 | 3 | 0 | 1 | 0 | 0 | |
| 2 | 2 | 0 | 0 | 1 | 0 | |
| 3 | 5 | 1 | 2 | 1 | 4 | 2 |
| 4 | 4 | 2 | 1 | 4 | 1 | 2 |
| Sum |
✅ A moderate-to-strong positive correlation. In practice you'll usually let a calculator do this — but doing it once shows you exactly what measures.
Compute 🧮
A different data set gives these sums:
1) Find 2) Find (decimal, round to 2 places)
The Coefficient of Determination
Square the correlation to get (always between and ). It has a concrete meaning:
🔑 is the proportion of the variation in that is explained by the linear relationship with .
If the Hours vs. Score data gives , then So about 98% of the variation in test scores is explained by hours studied; the remaining 2% is due to everything else.
⚠️ Because comes from squaring, it loses the sign — it cannot tell you the direction. A correlation of and one of both give .
Concept Check 🎯
Part 3: The Line of Best Fit
📈 Linear Regression and Correlation
Part 3 of 5 — The Line of Best Fit
🔑 The Goal: Find the single straight line that comes closest to all the points. We call it the least-squares regression line, and it lets us predict from .
The Least-Squares Regression Line
Out of all possible lines, the least-squares line is the one that makes the total of the squared vertical distances from the points to the line as small as possible.
The hat on ("-hat") signals a predicted value, not an observed one.
- = slope — how much changes for each +1 increase in .
- = -intercept — the predicted when .
The slope and correlation are linked through the standard deviations and :
💡 The slope always has the same sign as : a positive correlation gives an upward-sloping line, a negative correlation a downward-sloping one.
Concept Check 🎯
Building the Line: Worked Example
Use the Hours vs. Score data: and .
Step 1 — Means. , .
Step 2 — Sums of squares. Working from the deviations gives
Step 3 — Slope. The slope can be found directly as :
Step 4 — Intercept. Use :
The line:
✅ Check: the regression line always passes through the point of averages . Test it: ✓
Order the Steps 🔽
You're finding the regression line for a data set with , , , and .
The Two-Step Recipe
Every regression problem in Algebra 1 boils down to the same two moves, in order:
You must find the slope first, because the intercept formula needs it. Then assemble .
🔑 Sanity check every line you build: plug in and you should get exactly , because the line always passes through .
Build the Line 🧮
A data set has , , , .
1) Slope 2) Intercept
Part 4: Predictions, Residuals & Cautions
📈 Linear Regression and Correlation
Part 4 of 5 — Predictions, Residuals & Cautions
🔑 The Payoff: With the line in hand, plug in any to predict . But predictions come with rules — and a famous warning about causation.
Making Predictions
To predict, substitute the -value into the line.
Using (Hours vs. Score):
Predict the score for 6 hours of study:
Predict the score for 2.5 hours:
Interpolation vs. Extrapolation
- Interpolation — predicting inside the range of the data ( between 1 and 5 here). Generally safe.
- Extrapolation — predicting outside the data range (e.g. hours). Risky — the linear pattern may not hold out there.
⚠️ Extrapolation is the #1 prediction trap. Our line would "predict" a score of for 20 hours — impossible on a 100-point test. Never trust a prediction far outside the data.
Predict with the Line 🧮
A delivery company models cost (, dollars) against distance (, miles) with
1) Predicted cost for a 10-mile trip: (dollars) 2) Predicted cost for a 25-mile trip: (dollars)
Residuals: How Far Off Was the Prediction?
A residual is the vertical gap between an actual data point and the line:
Worked Example
In the Hours vs. Score data, the student who studied 2 hours actually scored 65. The line predicts So the residual is
A positive residual means the point sits above the line (the model under-predicted). A negative residual means it sits below the line.
💡 The least-squares line is built so the residuals always sum to zero — positives and negatives perfectly cancel. That's what makes it the "best fit."
Compute Residuals 🧮
Use . A student studied 4 hours and scored 80.
1) Predicted score 2) Residual — enter the residual (it is negative)
Correlation Is Not Causation
A strong correlation means two variables move together — it does not prove one causes the other.
⚠️ The classic example: Across a town, ice-cream sales and drowning deaths are strongly positively correlated. Ice cream doesn't cause drownings! A hidden lurking variable — hot summer weather — drives both up at once.
To establish causation you need a controlled experiment, not just a high . Always ask: Could a third variable explain both?
Concept Check 🎯
Part 5: Mixed Practice & Mastery Check
📈 Linear Regression and Correlation
Part 5 of 5 — Mixed Practice & Mastery Check
You can now (1) describe a scatterplot, (2) interpret and , (3) build the line of best fit, and (4) predict, find residuals, and avoid the causation trap. Let's put it all together.
Quick Reference
| Goal | Key move |
|---|---|
| Describe a scatterplot | direction (pos/neg) · form (linear?) · strength |
| Measure strength + direction | , with |
| "% of variation explained" | (between and ) |
| Slope of the line | |
| Intercept of the line | |
| Predict | plug into |
| Residual | (observed predicted) |
⚠️ Remember: the sign of matches the sign of ; drops the sign; extrapolation is risky; and correlation never proves causation.
Mixed Practice 🎯
One Full Problem, Start to Finish
A typical exam question hands you the summary numbers and asks for the line and a prediction. The flow is always the same:
- Slope:
- Intercept:
- Assemble:
- Predict: substitute the requested
Try the complete cycle below — find the slope, the intercept, and then make a prediction.
Build & Predict 🧮
A data set has , , , .
1) Slope 2) Intercept 3) Using , predict when .
You're Ready
You can describe a scatterplot, read and , build , predict and interpret residuals, and steer clear of the causation trap. One last set of three questions seals the lesson.
💡 On each Exit-Quiz item, decide which tool it's testing first — strength of , a residual, or causation — then apply the matching move.
Exit Quiz ✅
Answer all three to finish the lesson.