Unit 2 of 4 · Correlation and linear regression
Choose the response and fit a line
Distinguish the two regression directions and their residuals.
From association to a regression model
Decide which coordinate is the response before fitting. Regression of y on x minimises squared vertical residuals on the usual axes; regression of x on y minimises squared horizontal residuals. Rearranging a fitted line does not generally fit the other response.
Linear regression fits a line to observed paired data. Check the scatter and coefficient before deciding whether a straight-line model is suitable; the usual fitting method is least squares. There are two directions: regression of on and regression of on . A model can support estimation and, with appropriate assumptions, inference about population parameters; a fitted line alone does not establish those assumptions.
The source compares the two lines on the same axes: when , their directions differ markedly; near they almost coincide, also near . Two regression directions preserves both schematic comparisons. This describes the same dataset and fixed axis scales; the visual angle also depends on axis scaling. Later source pages supply the residual definitions, coefficients and conditions for choosing the appropriate direction.
Fit the response coordinate: two least-squares problems
For regression of on , write , with explanatory and response. Plot horizontally and vertically. Each residual is the vertical difference between an observed and its prediction at the same :
Choose to minimise . It is the sum of squared residuals, not a signed total residual or the sum of perpendicular distances. The source calls “Total residual”; the precise objective is the sum of squares. It depends on both and .
Thus is the -intercept and the gradient/regression coefficient. For defined , the gradient and correlation have the same sign. The -on- line passes through and requires . Use the calculator for complete paired data; MF27 formulas are useful when calculator use is not permitted or only sufficient summary information is given.
Fit x as the response
For regression of on , take as explanatory and as response and write . On the same conventional axes, its residuals are horizontal:
This line also passes through and requires . The two source residual schematics are retained in Vertical and horizontal residuals. Swapping regression direction changes the quantity minimised; rearranging one fitted equation does not generally produce the other fitted regression. If , the reverse line is and cannot be written as a single-valued function.
The eight-observation example fits both lines, sketches them on the same axes, and uses their intersection to recover the means. Keep full coefficients for this calculation; premature rounding changes the intersection.
Fit both responses with an imperfect dataset
For observations , use a calculator to fit y on x and x on y. For an observational prediction of x when y=3, compare the reverse fit with rearranging the forward fit. Identify which residual direction each fit minimises; do not derive the fitting formulae.
After your attempt: compare the reasoning
Both sample means are 2.5. The forward line is , while the reverse line is . At y=3, the reverse-fit estimate is . Rearranging the forward line gives , a different estimate.
The forward line minimises squared y residuals; the reverse line minimises squared x residuals. For this observational prediction of x from y, use the x-response fit. A controlled-input calibration question can have a different modelling setup, so identify the role of the variables rather than choosing a line from the letter being requested alone.
Diagrams for this unit
Open 2 diagramsTry these examples
Open an example in chapter practice. Try it first, then read its solution. Use “Learn this step” to return to this unit.