13. Straight-Line Relationships: Correlation and Simple Regression
Explanation
Linear equations and scatter diagrams
A straight line is written in statistics as y = a + bx, where x is the independent (explanatory) variable and y is the dependent (response) variable. The slope b is the average change in y for each one-unit increase in x; the y-intercept a is the predicted y when x = 0 (it may have no practical meaning if x = 0 is outside the data).
A scatter diagram (scatter plot) plots each pair (x, y) as a point. Examine four things: direction (rising or falling), form (straight or curved), strength (how tightly points hug a pattern), and outliers. It shows whether a linear model is reasonable before you compute anything.
Correlation
The correlation coefficient r measures the strength and direction of the linear association between x and y.
- −1 ≤ r ≤ 1. Positive r means x and y tend to rise together; negative r means one rises as the other falls; r near 0 means little linear relationship (a curved relationship may still exist).
- |r| near 1 = strong linear relationship. It has no units and does not change if x and y are swapped or rescaled.
- Correlation is not causation: lurking variables can drive both.
- One extreme point can raise or lower r a lot.
The population correlation is ρ (rho). To test H₀: ρ = 0 (no linear relationship in the population) a t test with df = n − 2 is used; a small p-value suggests a real linear relationship.
The regression equation
The least-squares regression line, ŷ = a + bx, is the line that makes the sum of squared errors (SSE) as small as possible. A residual is the actual y minus the predicted ŷ (the vertical distance from the point to the line). Properties of the line:
- It passes through (x̄, ȳ).
- Slope b = r·(s_y/s_x), intercept a = ȳ − b·x̄.
- Residuals sum to zero.
- It predicts y from x; it is not reversible (regressing x on y gives a different line).
Prediction is safe within the range of the observed x values (interpolation). Extrapolation (predicting beyond that range) is unreliable because the pattern may not continue. A point that lies far from the line (|residual| ≥ about 2s) is a suspected outlier; a point that strongly changes the line is influential.
Conditions for regression
The textbook lists: linear relationship in the population, independent residuals, normally distributed y-values for each x, equal variance of y for each x, and random data collection. A residual plot (residuals against x or ŷ) should show no pattern; curvature or a funnel shape signals trouble.
Coefficient of determination
r² is the square of the correlation. It is the proportion of the variation in y explained by the regression line (by variation in x); the remainder is unexplained. Written as a percentage, r² = 0.60 means 60% of the variation in y is explained by the linear relationship. In terms of sums of squares, r² = SSR/SST = 1 − SSE/SST.
Standard error of the estimate
s = √(SSE/(n − 2)) is the standard deviation of the residuals. It estimates σ, the typical spread of actual y-values around the line, in the units of y. Dividing by n − 2 reflects two estimated parameters (a and b). A small s means predictions are precise. The standard error is also used for slope inference and to judge outliers.
Common mistakes
Saying a high r proves cause; predicting far outside the data; interpreting the intercept when x = 0 is impossible; forgetting that r only detects linear patterns; mixing up r and r²; swapping x and y when making a prediction.
Practice tasks
- For the line ŷ = 3 + 2x, interpret slope and intercept and predict y when x = 4.
- What does r = −0.9 say? Does r = 0 mean no relationship at all?
- Data: (1,2), (2,4), (3,5), (4,4), (5,5). Find x̄, ȳ, Sxx, Sxy, Syy.
- Find the regression equation for task 3.
- Find r and r² for task 3 and interpret r².
- Compute the residual at x = 3 and the standard error of the estimate s (use SSE = Syy − b·Sxy).
- Predict y at x = 6 from task 4, and explain why predicting at x = 40 would be questionable.
Original author (OpenStax, Rice University). License / permission: CC BY-NC-SA 4.0. If you noticed a mistake or copyright issues, please contact: lebroskiofficial@proton.me