A single straight line can summarise a linear trend well enough to make predictions with — as long as you stay inside the range of data it was built from.
9 min read4 worked examples
Explanatory and response variables
In a regression context, the variable used to make a prediction is called the explanatory (or independent) variable, and is plotted on the horizontal axis. The variable being predicted is the response (or dependent) variable, plotted on the vertical axis.
The regression line
When a scatter diagram shows a roughly linear trend, a single straight line — the regression line — can be drawn through the data to summarise it. The regression line of $y$ on $x$ is written in the form:
$y = a + bx.$
You'll be given a regression line to interpret and use for prediction — calculating $a$ and $b$ from raw data isn't required at this level.
Watch out — the order of the variables matters
The regression line of $y$ on $x$ is generally different from the regression line of $x$ on $y$. A line built to predict $y$ from $x$ cannot simply be rearranged to reliably predict $x$ from $y$ — each direction of prediction has its own, separately fitted line.
Interpreting the gradient
The coefficient $b$ tells you the change in $y$ for each unit change in $x$. If the data is positively correlated, $b$ will be positive; if negatively correlated, $b$ will be negative. A good interpretation refers to both the context of the question and the numerical value of the gradient, phrased as a complete sentence.
Interpolation vs extrapolation
Using the regression line to predict a value within the range of the original data is interpolation, and is generally reliable. Using it to predict beyond that range is extrapolation — there's no evidence the same linear trend continues outside the data actually collected, so extrapolated predictions can be seriously misleading.
Justifying the use of a regression line
A regression line is only a sensible model when the scatter diagram shows a genuinely linear trend. The stronger the correlation, the more confidently the line can be used for interpolation — but strong correlation alone never justifies extrapolating far beyond the data.
Worked example 1
Identifying explanatory and response variables
A researcher records the number of hours of sunshine per day and the number of ice creams sold at a shop over 20 days, wanting to predict sales from sunshine. State which variable is explanatory and which is the response variable, and which axis each would be plotted on.
MethodIdentify which variable is used to predict the other
1
Sunshine is being used to predict sales, so hours of sunshine is the explanatory variable — plotted on the horizontal axis.
The variable doing the predicting.
2
Ice creams sold is being predicted, so it is the response variable — plotted on the vertical axis.
The variable being predicted.
▪ identified
Worked example 2
Using a regression line, and spotting extrapolation
A regression line for predicting exam score ($y$) from hours of revision ($x$) is $y = 38 + 7x$, fitted using data from students who revised between $1$ and $9$ hours. Use the line to predict the score for a student who revised for $5$ hours, and comment on a prediction for a student who revised for $15$ hours.
MethodSubstitute into the line; check whether each x-value lies in the original range
1
$x=5$ lies within the original data range ($1$ to $9$ hours), so this is interpolation.
Check the value against the data's range first.
2
$y = 38+7(5) = 38+35=73$, a reasonably reliable prediction.
Substitute x = 5 into the regression line.
3
$x=15$ lies far outside the original range of $1$ to $9$ hours, so using the line here is extrapolation.
Compare 15 against the data's range.
4
The line gives $y=38+7(15)=143$, which is not a sensible exam score — there's no evidence the linear trend continues this far beyond the data, so this prediction should not be trusted.
Extrapolated predictions can be unreliable or nonsensical.
▪ solved
The key insight
The regression line is only fitted to — and only trustworthy within — the range of $x$ values it was built from. A wildly unrealistic answer, like a score of $143$, is often the clue that a prediction has crossed from interpolation into extrapolation.
Worked example 3
Interpreting the gradient of a regression line
The equation of the regression line for predicting a plant's height, $h$ cm, from the number of days since planting, $d$, is $h = 4.2+0.85d$, fitted using data from the first $40$ days. Give an interpretation of the gradient of this regression line.
MethodState the change in the response variable per unit change in the explanatory variable, in context
1
The gradient is $0.85$.
The coefficient of $d$ in the regression line.
2
This means that, on average, the plant's height increases by approximately $0.85$ cm for each additional day since planting, over the $40$-day period studied.
Interprets the gradient in the context of the question.
▪ interpreted
Examiner's eye
A full interpretation states units, refers to the actual variables in the question, and — ideally — notes that this rate applies specifically over the range of days the data was collected from.
Worked example 4
Why you can't just rearrange a regression line · Challenge
The regression line of $y$ on $x$ is $y=15+2.4x$. A student wants to predict $x$ when $y=63$, and rearranges the equation to find $x=\dfrac{63-15}{2.4}=20$. Explain why this may not give a reliable prediction.
MethodThink about what the y-on-x line was actually fitted to minimise
1
The regression line of $y$ on $x$ is fitted to minimise the vertical (y-direction) distances between the data points and the line.
This is what "least squares" means for a y-on-x line.
2
A line used to predict $x$ from $y$ should instead minimise the horizontal (x-direction) distances — a different fitting criterion, giving a different line in general.
The regression line of x on y is a separate calculation.
3
Rearranging the $y$-on-$x$ line to solve for $x$ gives a number ($x=20$ here), but it is not the same as the true regression line of $x$ on $y$, so it shouldn't be trusted as a proper prediction of $x$.
Algebraic rearrangement isn't the same as re-fitting the line.
▪ explained
Look deeper
The two regression lines (y on x, and x on y) only coincide when the correlation is perfect ($r=\pm1$). For any weaker correlation, they are genuinely different lines — which is exactly why exam questions are careful to specify "the regression line of $y$ on $x$" rather than just "the regression line".
Common mistake
Don't use a regression line to predict values far outside the range of the original data, and don't assume a regression line can be rearranged to predict in the opposite direction. Both are common ways a seemingly correct calculation produces an untrustworthy answer.
Check yourself
A regression line for predicting monthly heating cost ($y$, in £) from average outdoor temperature ($x$, in °C) is $y = 180 - 4x$, fitted using data where $x$ ranged from $2$°C to $18$°C. Predict the heating cost when the temperature is $10$°C, and comment on using the line to predict the cost at $30$°C. (Hint: check whether each x-value lies inside the original range before trusting the prediction.)
Method
1
$x=10$ lies within $2$ to $18$°C, so this is interpolation: $y=180-4(10)=140$, a reasonably reliable prediction of £140.
2
$x=30$ lies well outside the original range, so this would be extrapolation.
3
$y=180-4(30)=60$ — but since there's no evidence the linear trend continues this far beyond the data, this prediction should not be trusted.