Examining Relationships — Master Notes
1. The Big Picture: Role-Type Classification
Two variables → classify each by role and type before picking any tool.
Roles
Explanatory (X) — predicts/explains/affects the other (aka independent).
Response (Y) — the outcome (aka dependent).
Types: Categorical (C) or Quantitative (Q)
The Four Cases (explanatory listed first):
Case | Explanatory | Response | Tool |
|---|---|---|---|
C→Q | Categorical | Quantitative | Side-by-side boxplots + descriptive stats |
C→C | Categorical | Categorical | Two-way table + conditional % |
Q→Q | Quantitative | Quantitative | Scatterplot + correlation (r) + regression line |
Q→C | Quantitative | Categorical | (not covered in this course) |
Principle: First classify the data structure into one of the four cases — only then pick the statistical tool.
2. Case C→Q (categorical X, quantitative Y)
Display: side-by-side boxplots
Numbers: descriptive stats (min, Q1, median, Q3, max) computed separately per category
Interpretation = compare the distributions of Y across levels of X (center, spread, shape)
Example takeaway style: "poultry hot dogs have a lower median calorie count than beef/meat" — compare medians, IQRs, ranges.
3. Case C→C (categorical X, categorical Y)
Display: two-way table (contingency table) — rows/cols = categories, cells = counts, margins = Totals.
Never compare raw counts across groups of different sizes — always convert to conditional percentages.
Conditional % = cell count ÷ total of the row or column the explanatory variable sits in.
Explanatory in rows → row percentages.
Explanatory in columns → column percentages.
Compare the % pattern of the response variable across levels of the explanatory variable.
Visual alternative: double bar chart.
4. Case Q→Q — Scatterplots
Plot: X = explanatory (horizontal), Y = response (vertical). Each point = one individual.
Describe a scatterplot the same way you describe a distribution: overall pattern + deviations.
Overall pattern = Direction + Form + Strength
Direction: positive (both ↑ together), negative (one ↑, other ↓), or none.
Form: linear, curvilinear, clusters, or other. Always state the simplest shape that fits.
Strength: how tightly points hug the form. Hard to judge by eye — the same data can look strong or weak depending on axis scaling, which is exactly why we need a numerical measure (r).
Deviations = Outliers
Points that don't follow the pattern.
Key distinction: an outlier can be extreme in magnitude but still consistent with the direction of the relationship (e.g., the elephant in gestation/longevity data), vs. an outlier that breaks the pattern entirely.
Labeled scatterplots: color/mark subgroups within the data (e.g., hot dog type) to reveal more structure.
5. Correlation Coefficient (r)
Definition: r measures the strength and direction of a LINEAR relationship between two quantitative variables.
Range: −1 ≤ r ≤ 1
r near +1 → strong positive linear relationship
r near −1 → strong negative linear relationship
r near 0 → weak/no linear relationship
Sign of r = direction; magnitude of r = strength.
Properties of r (high-yield for exams)
Unitless, unaffected by changing units of measurement (feet→meters, etc.) on either variable.
Only captures linear association. A strong curvilinear relationship can have r ≈ 0 (fuel-usage vs. speed example: r = −0.172 despite a near-perfect curve). Conversely, a curved relationship can have r close to 1 (incentive/response-rate example, r = 0.876). → r alone cannot tell you if a relationship is linear — always look at the scatterplot first.
Very sensitive to outliers.
An outlier that goes against the pattern → weakens (pulls r toward 0).
An outlier that is consistent with the pattern's direction → strengthens r (pulls it toward ±1).
r and the scatterplot are a package deal — never report r without having looked at the plot.
6. Linear Regression (Least-Squares Line)
Used only when the scatterplot shows a linear form.
Equation: Ŷ = a + bX
b = slope, a = intercept
Least squares criterion: the line that minimizes the sum of squared vertical deviations (residuals) of the points from the line.
Formulas (given from software output):
Slope: b = r · (Sy / Sx)
Intercept: a = ȳ − b·x̄ (calculate b first — a depends on it)
Interpreting the slope: the average change in Y for a 1-unit increase in X.
Example: slope = −3 → "for every year older a driver is, max legibility distance decreases on average by 3 feet."
Interpreting the intercept: predicted Y when X = 0 (not always meaningful in context).
Prediction: plug an X value into the equation to get a predicted Y (Ŷ).
Extrapolation — know this cold:
Predicting Y for X values outside the range of the observed data = extrapolation.
There's no evidence the linear pattern continues beyond the data → unreliable, avoid it.
Classic exam trap: "predict for age 90" when data only goes up to 82.
7. Causation, Association & Lurking Variables
Core principle (repeated constantly — will be tested): Association does NOT imply causation.
Lurking variable: a variable not included in the study (not X, not Y) that could substantially change how you interpret the X–Y relationship.
Two ways a lurking variable can operate:
Common cause — the lurking variable affects both X and Y, creating a fake association with no direct causal link (Firefighters vs. Fire Damage → real driver is fire severity).
Confounding — the lurking variable is tangled up with X, so its effect can't be separated from X's effect on Y (US vs. international SAT scores → confounded with which subgroup of each population takes the test).
Simpson's Paradox
When including a lurking variable reverses the direction of an association seen in the aggregated (combined) data.
Classic example: Hospital A has a higher overall death rate than Hospital B, but once you split by severity of illness, Hospital B actually has the higher rate in both severity groups. Explanation: Hospital A treats far more severely-ill patients, skewing the overall (unadjusted) numbers.
Not all lurking variables cause a paradox — sometimes they just deepen understanding without flipping the direction (e.g., SAT vs. ACT by state).
Quick-Fire Exam Cheat Sheet
Explanatory = X = predictor. Response = Y = outcome.
C→Q: boxplots. C→C: two-way table + conditional %. Q→Q: scatterplot + r + regression.
Scatterplot description = direction, form, strength + outliers.
r: only linear, only −1 to 1, unitless, outlier-sensitive, useless alone for judging linearity.
Regression line: Ŷ = a + bX, b = r(Sy/Sx), slope = "average change in Y per 1-unit increase in X."
Never trust predictions outside the data range → extrapolation.
Correlation/association ≠ causation. Watch for lurking variables and Simpson's Paradox.