This note covers the regression line of \(x\) on \(y\): when to use it, how to find it on a GDC, and how it differs from the more familiar line of \(y\) on \(x\). Choosing the right line matters whenever you want to predict one quantity from another, for example estimating power output from wind speed.
Key ideas
For bivariate data, each item gives a pair of values \((x, y)\). A scatter diagram shows whether there is a linear relationship, and the Pearson correlation coefficient \(r\) measures how strong it is. When the relationship is roughly linear, a line of best fit can be used to make predictions.
There are two regression lines, and they answer different questions.
- The regression line of \(y\) on \(x\) is used to estimate \(y\) from a known value of \(x\). The variable you know is \(x\).
- The regression line of \(x\) on \(y\) is used to estimate \(x\) from a known value of \(y\). The variable you know is \(y\).
The line of \(x\) on \(y\) is written \(x = cy + d\). The variable being predicted is on the left. It is found by minimising the squared horizontal distances from the points to the line, not the vertical ones. This is why you cannot simply rearrange the \(y\) on \(x\) line to predict \(x\). The two lines are different unless the points lie exactly on a straight line.
Finding the line. Enter the data into the statistics mode of your GDC and choose linear regression. Swap the two lists so that the known variable is entered as the "\(x\)" list. In other words, to get the line of \(x\) on \(y\), enter the \(y\) values in the explanatory list and the \(x\) values in the response list. The calculator then gives the gradient and intercept of \(x = cy + d\). Store unrounded values and use them in later calculations.
Facts about the two lines.
- Both lines pass through the mean point \((\bar{x}, \bar{y})\).
- The stronger the correlation, the closer the two lines are to each other. If \(r = \pm 1\) they are the same line.
- The product of the two gradients (when each line is written with its own subject, \(y = mx + k\) and \(x = cy + d\)) equals \(r^2\), so \(m \times c = r^2\).
Reliability of predictions.
- Interpolation means predicting inside the range of the data. This is generally reliable when \(|r|\) is close to 1.
- Extrapolation means predicting outside the range of the data. It is risky because the pattern may not continue.
- A strong correlation shows an association. It does not prove that one variable causes the other.
Definitions and formulae
| Term or formula | Meaning / when to use |
|---|---|
| \(x = cy + d\) | Regression line of \(x\) on \(y\). Use it to estimate \(x\) from a given \(y\). |
| \(y = mx + k\) | Regression line of \(y\) on \(x\). Use it to estimate \(y\) from a given \(x\). |
| \((\bar{x}, \bar{y})\) | Mean point. Both regression lines pass through it. |
| \(r\) | Pearson correlation coefficient, \(-1 \le r \le 1\). Describes strength and direction of linear association. |
| \(m \times c = r^2\) | Link between the gradients of the two lines. The sign of \(r\) matches the sign of the gradients. |
| Interpolation / extrapolation | Estimating inside / outside the range of the given data. |
Worked examples
Example 1 A wind farm records wind speed \(y\) (m/s) and power output \(x\) (MW) for a small turbine. (a) Find the regression line of \(x\) on \(y\). (b) Estimate the power output when the wind speed is 9 m/s.
Wind speed \(y\): 4, 6, 8, 10, 12, 14.
Power \(x\): 2.1, 3.4, 5.2, 6.1, 8.3, 9.0.
We want to predict \(x\) from \(y\), so we need the line of \(x\) on \(y\).
(a) On the GDC enter the wind speeds as the explanatory list and the power values as the response list, then run linear regression. The output is gradient \(0.7157\dots\) and intercept \(-0.7581\dots\).
So \(x = 0.716y - 0.758\) (3 s.f.).
(b) Use the unrounded values at \(y = 9\): \(x = 0.71571\times 9 - 0.75810 = 5.683\dots\).
Answer: (a) \(x = 0.716y - 0.758\); (b) about 5.68 MW.
Example 2 A study of a sample gives the regression line of \(x\) on \(y\) as \(x = 0.25y + 3\) and the regression line of \(y\) on \(x\) as \(y = 2.4x - 1\). Find the mean of \(x\) and the mean of \(y\), and find \(r\).
Both lines pass through \((\bar{x}, \bar{y})\), so solve them simultaneously.
Substitute \(y = 2.4x - 1\) into the first line: \(x = 0.25(2.4x - 1) + 3 = 0.6x - 0.25 + 3\).
So \(0.4x = 2.75\), giving \(\bar{x} = 6.875\).
Then \(\bar{y} = 2.4(6.875) - 1 = 15.5\).
Check in the other line: \(0.25(15.5) + 3 = 6.875\). It matches.
The gradients multiply to give \(r^2\): \(r^2 = 0.25 \times 2.4 = 0.6\). Both gradients are positive, so \(r\) is positive: \(r = \sqrt{0.6} \approx 0.775\).
Answer: \(\bar{x} = 6.875\), \(\bar{y} = 15.5\), \(r \approx 0.775\).
Example 3 Use the turbine data from Example 1, where the correlation coefficient is \(r = 0.994\). A manager uses the line \(x = 0.716y - 0.758\) to estimate the power at a wind speed of 30 m/s. Comment on the reliability of the estimate.
The estimate would be \(x = 0.71571\times 30 - 0.75810 = 20.7\) MW.
The data only cover wind speeds from 4 to 14 m/s, so 30 m/s is well outside the range. This is extrapolation.
Although \(r\) is very close to 1, real turbines reach a maximum output and shut down in very strong wind, so the linear pattern is unlikely to continue.
Answer: the estimate of 20.7 MW is unreliable because it is extrapolation. The estimate at 9 m/s in Example 1 is reliable because 9 lies inside the data range and \(r\) is close to 1.
Common errors
- Common error: using the \(y\) on \(x\) line, rearranged, to predict \(x\). The rearranged line is not the regression line of \(x\) on \(y\).
- Common error: entering the lists the wrong way round on the GDC, which gives the line for the wrong variable.
- Common error: trusting an extrapolated prediction just because \(r\) is close to 1.
- Common error: saying a high correlation proves that one variable causes the other.
- Common error: forgetting that the two lines meet at \((\bar{x}, \bar{y})\), and so missing a quick way to find the means.
Exam tip: Before calculating, write down which variable you know and which you are estimating. The variable you are estimating goes on the left of the equation. Then comment on whether the prediction is interpolation or extrapolation.
Check yourself
- You know a student's physics score \(y\) and want to estimate their maths score \(x\). Which regression line should you use?
Answer
The regression line of \(x\) on \(y\), because \(y\) is known and \(x\) is being estimated. - The regression line of \(x\) on \(y\) is \(x = 0.5y + 4\). Estimate \(x\) when \(y = 10\).
Answer
\(x = 0.5(10) + 4 = 9\). - The lines are \(x = 0.3y + 2.5\) and \(y = 2.5x - 2.5\). Find \(\bar{x}\) and \(\bar{y}\).
Answer
Substitute: \(y = 2.5(0.3y + 2.5) - 2.5 = 0.75y + 3.75\), so \(0.25y = 3.75\) and \(\bar{y} = 15\). Then \(\bar{x} = 0.3(15) + 2.5 = 7\). - Data for \(y\) run from 4 to 14. Why is an estimate at \(y = 30\) less trustworthy than one at \(y = 9\)?
Answer
\(y = 30\) is outside the range of the data (extrapolation), so we cannot assume the linear pattern continues. \(y = 9\) is inside the range (interpolation).