Unit 2 · Exploring Two-Variable Data
The Case of the
Connected Clues
A self-study casebook for young statisticians. Six cases. One rookie detective. A pile of numeric clues waiting to be understood.
Skill: Scatterplots & Correlation
The First Look at the Scene
What to look for
- Scatterplot — a graph that plots one quantitative variable against another for each individual. The explanatory (x) variable goes on the horizontal axis; the response (y) variable goes on the vertical axis.
- Direction — positive association: as x goes up, y tends to go up. Negative association: as x goes up, y tends to go down.
- Form — does the pattern look like a straight line (linear), a curve, or no pattern at all?
- Strength — how closely do the points hug the pattern? Tightly clustered = strong. Widely scattered = weak.
- Unusual features — any point that breaks from the pattern (an outlier) or splits into separate clusters.
The Study Hours Case — will this dataset return all through the file
Six suspects reported how many hours they studied for a test, and their test score was recorded.
| Suspect | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Hours studied (x) | 1 | 2 | 3 | 4 | 5 | 6 |
| Test score (y) | 50 | 55 | 65 | 70 | 78 | 90 |
A new suspect studied 0 hours. Based on the pattern in Evidence A, what would you predict?
Skill: Least-Squares Regression Line
Drawing the Detective's Path
What to know
- The least-squares regression line is the line ŷ = b₀ + b₁x that makes the sum of the squared vertical distances from each point to the line as small as possible.
- b₁ (the slope) is the predicted change in y for every one-unit increase in x.
- b₀ (the intercept) is the predicted value of y when x = 0 — but it's only meaningful if x = 0 actually makes sense for the data.
- The line always passes through the point (x̄, ȳ) — the mean of x and the mean of y.
- Interpolation (predicting inside the range of observed x-values) is trustworthy. Extrapolation (predicting far outside that range) is risky — the pattern might not continue.
Fitting the line to the Study Hours Case
Using the six suspects from Case 01 (x̄ = 3.5, ȳ = 68), technology gives the least-squares line:
Intercept (40.60): a suspect who studied 0 hours is predicted to score about 40.60 — but since x = 0 sits right at the edge of what was observed, treat this cautiously.
Interpolation example — predict the score for 4.5 hours studied (inside the 1–6 range):
ŷ = 40.60 + 7.83(4.5) = 75.8
Extrapolation warning — predict the score for 12 hours studied (far outside the 1–6 range):
ŷ = 40.60 + 7.83(12) = 134.6 — an impossible test score! This is exactly why extrapolation is dangerous.
Using ŷ = 40.60 + 7.83x, what score is predicted for a suspect who studied 3.5 hours?
Hint: 3.5 is x̄ — and the regression line always passes through (x̄, ȳ).
Skill: Correlation Coefficient r and r²
Measuring How Strong the Connection Is
What to know
- Correlation (r) measures the direction and strength of a linear relationship. It always falls between −1 and 1.
- The sign of r matches the direction (positive or negative). The size of r (how close to 1 or −1) matches the strength.
- r = 0 means no linear relationship — it does not necessarily mean no relationship at all (a curve could still exist).
- r², the coefficient of determination, is the proportion (often shown as a %) of the variation in y that is explained by the linear relationship with x.
- r² is easier to explain in plain English than r, which is why statisticians report both.
How strong is the Study Hours connection?
For the six suspects in Cases 01–02, technology reports:
r² = 0.984, or 98.4%, means about 98.4% of the variation in test scores among these suspects is explained by the linear relationship with hours studied. Only about 1.6% is left over — due to other factors, or plain randomness.
A different case reports r = 0.85. What is r², as a percent?
Skill: Residuals & Residual Plots
Checking the Detective's Work
What to know
- Residual = actual − predicted = y − ŷ.
- A positive residual means the model underestimated that point (actual is higher). A negative residual means the model overestimated it.
- Least-squares regression makes the sum of the residuals equal to 0 (they balance out).
- A residual plot graphs the residuals against x. If the points are scattered randomly around the zero line with no leftover pattern, a linear model was a good choice.
- If the residual plot shows a curve, that's a signal the true relationship is not linear, even if r was high.
Residuals for the Study Hours Case
| x | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Actual y | 50 | 55 | 65 | 70 | 78 | 90 |
| Predicted ŷ | 48.43 | 56.26 | 64.09 | 71.91 | 79.74 | 87.57 |
| Residual (y−ŷ) | 1.57 | −1.26 | 0.91 | −1.91 | −1.74 | 2.43 |
A suspect actually scored 82. The regression line predicted 78. What is the residual?
Skill: Outliers vs. Influential Points
The Suspect Who Doesn't Fit
What to know
- An outlier is any point that doesn't fit the overall pattern — it can be unusual in its x-value, its y-value, or both.
- An influential point is a point whose removal would noticeably change the regression line (its slope and/or intercept).
- The key factor for influence is usually an extreme x-value (called high leverage) — points near the middle of the x-values rarely swing the line much, even if their y-value is strange.
- Not every outlier is influential, and not every influential point looks dramatic on a scatterplot at first glance — always check what happens to the line with and without it.
The Screen Time Case (a fresh dataset)
Baseline: 5 suspects' daily screen time (hours) vs. self-reported happiness (1–10 scale) — a perfect negative pattern:
| Screen time (x) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Happiness (y) | 8 | 7 | 6 | 5 | 4 |
Baseline line: ŷ = 9 − x, with r = −1.00 (perfectly linear).
Suspect A joins the case: x = 3, y = 20
This x-value (3) sits right in the middle of the x-range — low leverage.
Suspect B joins the case instead: x = 20, y = 3
This x-value (20) is far outside the original 1–5 range — high leverage.
Which suspect is the influential point, and why?
Skill: Two-Way Tables & Conditional Distributions
Sorting Suspects Into Groups
What to know
- A two-way table displays counts for two categorical variables at once — rows for one variable, columns for the other.
- A marginal distribution looks at just one variable's totals (the row or column sums), ignoring the other variable.
- A joint distribution gives each cell's count as a proportion of the entire table's total.
- A conditional distribution looks at one variable's distribution restricted to just one category of the other — for example, "among boys only, what percent like each subject?"
- To check for an association between two categorical variables, compare the conditional distributions across groups. If they're noticeably different, the variables appear related.
The Classroom Case
| Math | Art | Total | |
|---|---|---|---|
| Boys | 40 | 20 | 60 |
| Girls | 15 | 25 | 40 |
| Total | 55 | 45 | 100 |
Girls: Math = 15/40 = 37.5%, Art = 25/40 = 62.5%
Since 66.7% is quite different from 37.5%, the two conditional distributions don't match — this suggests gender and subject preference are associated in this classroom.
What percent of girls prefer Art?
Unit 2 Master Summary
The Complete Case Notebook
01 · Scatterplots
Plot the explanatory variable (x) against the response variable (y). Describe direction, form, strength, and any unusual features.
02 · Regression Line
ŷ = b₀ + b₁x. Slope = predicted change in y per unit x. The line always passes through (x̄, ȳ). Interpolate with confidence; extrapolate with caution.
03 · r and r²
r (−1 to 1) measures direction and strength of a linear relationship. r² is the percent of variation in y explained by x.
04 · Residuals
residual = y − ŷ. A random, patternless residual plot confirms a linear model fits well; a curve means it doesn't.
05 · Outliers vs. Influential Points
An outlier breaks the pattern. It's influential only if removing it substantially changes the line — usually because of an extreme x-value (high leverage).
06 · Two-Way Tables
Compare conditional distributions across groups. Different distributions between groups suggest an association between the two categorical variables.