Educerie · IB Diploma · Mathematics: analysis and approaches
IB Mathematics AA 4.10 · SL and HL
Regression line of x on y
The regression line of on predicts , so what do you use when the value you know is and the value you want is , and when can you trust the answer?
What you will learn
- Understand that the regression line of x on y minimises horizontal distances and is a different line from y on x.
- Know that the line used has the wanted variable on its left, and that neither line is rearranged to give the other.
- Know that both regression lines pass through the mean point.
- Understand that a prediction is reliable only with strong correlation and a given value inside the data's range.
You must be able to
- Write down the equation of the regression line of x on y from a GDC, as x = cy + d.
- Calculate an estimate of x from a given value of y using the correct line.
- Explain why the y on x line should not be used to estimate x.
- Comment on the reliability of an estimate, naming extrapolation where it applies.
- Calculate the mean point by solving the two regression equations together.
- Interpret the gradient of the x on y line in context.
In the exam. Paper 2, as 3 to 6 marks at the end of a bivariate data question that began in 4.4: after and the on line, find the on line, use it to estimate , and say why the other line would be wrong or the estimate unreliable. Paper 1, without a calculator: both lines are given, and you solve them together for the mean point or choose the right line for a prediction (3 to 5 marks).
1Two jobs, two lines
- In 4.4 the line of on came from least squares. Take each point's vertical distance to the line. This is the residual: how far the line misses when it predicts that .
- Square each residual, so misses above and below cannot cancel, and add the squares. The chosen line has the smallest total.
- Figure 1, left, shows those vertical misses for five points.
- Now reverse the task: you have a -value and need . Your error is how far left or right of the true you land: a horizontal distance.
- Squaring and adding horizontal gaps gives a different winner, the line of on , on the right of Figure 1. For those five points it is . The on line is .
- Rearranged, the first is (3 s.f.), far steeper than . Same dots, two answers to two questions.
Reading the names
- The variable before the word "on" is the one the line predicts. It sits alone on the left.
- " on " is .
- " on " is .
- Letters are only labels.
- Example: with and , "the regression line of on " is . It predicts .
To estimate , use on . To estimate , use on . Never rearrange one line to get the other.
Which line fits the situation?
- In IB questions the test is which value you are handed. The wanted variable goes on the left.
- Some textbooks add a second reason, about measurement. Say is measured precisely (or set by the experimenter) and is a rough reading. Then nearly all the scatter is in and the misses that matter are horizontal. The on line describes the relationship better.
- Example: a lifeguard judges wave heights by eye () while a buoy logs the true height (). Asked why on is appropriate, name the precise variable.
- This reason chooses the model. It does not change the prediction rule. An estimate of from a given still comes from the on line, as the guide's caution says.
2Finding the on line with technology
- A GDC has one linear regression command. It always fits "second list gradient first list intercept".
- For on , swap the roles: the -data is the first (independent) list and the -data the second.
- TI-84 Plus: in L1, in L2; run LinReg(ax+b) with Xlist = L2 and Ylist = L1.
- Casio: in the regression set-up, XList is the list holding the -data and YList the list holding the -data.
- TI-Nspire: in the linear regression dialog, choose the -column as X List and the -column as Y List.
- The screen still says "". The calculator does not know you swapped anything. Read its as your and its as your .
Write the answer as . Copying the calculator's letters unchanged loses marks.
The value of is the same in either order, so it is a quick check that you typed the data correctly.
Worked example 1: trees. A forester records the trunk diameter (cm) at chest height and the height (m) of eight trees of one species.
| Diameter (cm) | 18 | 22 | 27 | 31 | 36 | 40 | 45 | 52 |
|---|---|---|---|---|---|---|---|---|
| Height (m) | 13.0 | 11.8 | 17.5 | 14.2 | 20.1 | 16.4 | 22.8 | 21.0 |
With the lists in the usual order, as in 4.4:
With the lists swapped:
A drone measures a tree's height from above, not its trunk. The forester wants the diameter of a tree tall. Height is known and diameter is wanted: a job for on .
Figure 2 draws both lines through the data. Rearranging the on line instead, , gives , the grey mark on the figure. That is two centimetres out, purely from using the wrong line.
For the height of a tree, use on : . Rearranging the on line instead would give , again the wrong value.
Interpreting and
- In , says each extra metre of height goes with a predicted more diameter.
- The intercept would be the predicted diameter at height : impossible and far outside the data. As in 4.4, "the intercept has no sensible meaning here" is then a full interpretation.
3Choosing the line, finding it, using it
Exam questions bundle these skills. Here is a complete one.
Worked example 2: river depth. Volunteers at a stream read the water depth (cm) off a marker post by eye. An electronic meter logs the flow (litres per second) at the same moment. Eight readings:
| Depth (cm) | 12 | 18 | 25 | 31 | 38 | 44 | 52 | 60 |
|---|---|---|---|---|---|---|---|---|
| Flow (L ÷ s) | 0.9 | 1.6 | 1.8 | 3.1 | 3.0 | 4.6 | 4.4 | 6.2 |
(a) Explain why the regression line of on is appropriate. The meter gives precisely, while the eyeballed depth is the rougher measurement. So the error is mostly in , and the line that minimises horizontal distances describes the relationship better.
(b) Find it. Enter the flow list first and the depth list second:
(c) Estimate the depth when the flow is . The flow is known, so use this line: . The data's flows run from to , so this is interpolation. With the estimate is reliable.
(d) Estimate the flow when the depth is . Now the depth is known and the flow is wanted. Part (a) does not change the rule: an on line cannot always reliably predict .
Use on : , which gives .
Turning the line from (b) round would give . The gap is only because is close to . With weaker correlation it grows. A small gap is no licence to rearrange.
(e) Comment on using the line from (b) at a flow of . The prediction is .
A flow of is above every flow in the data (the largest is ). That is extrapolation, so the pattern may not continue and the estimate is unreliable.
(f) Interpret . Each extra of flow goes with a predicted extra of depth.
4Why rearranging gives the wrong answer
- The lines disagree because correlation is not perfect.
- Take the tree in Worked example 1. It is above the mean height of . A rearranged on line treats every tree as sitting exactly on that line, as if height fixed diameter. It gives .
- But with , height does not fix diameter: some tall trees are slim. A tall tree's best diameter estimate is above average, but by less. The on line pulls it back towards the mean diameter, to .
- Each line pulls its predictions towards the mean of the variable it predicts. That is why each is right only for its own variable.
- Figure 3 shows the gap as the correlation changes. When is weak, the lines open like scissors, one almost flat, one almost upright. A prediction from the wrong one is wildly out.
- As grows the blades close. At all the points sit on a single line, so the two regression lines are the same line. That is the only case in which rearranging one gives the other.
A check that is not on the syllabus
- Write the lines with their own variable on the left: and . The product of the gradients is then .
- Trees: and .
- Worked example 2: .
- The gradients share a sign and their product cannot exceed . If yours do not, one is wrong.
5Both lines pass through the mean point
- Every least squares regression line passes through the mean point . Its coordinates are the mean of the -values and the mean of the -values.
- Both lines pass through it, so they always cross there (the cross in Figure 2). A question can use this with no data at all.
Worked example 3 (no calculator). For some bivariate data, the line of on is and the line of on is . Find and .
The mean point is on both lines, so solve them together. Figure 4 shows the crossing.
So and .
One line and one mean
- Suppose the line of on is and .
- The mean point lies on the line, so . This works only for the mean. Any other gives a prediction, not .
Both lines, then a prediction
- Paper 1 can print both equations and then ask for estimates. Picking the right line is the method mark.
- Example: take and .
- The mean point is , since and .
- To estimate when , use the first line and get .
- To estimate when , use the second and get .
6When a prediction can be trusted
The correct line is necessary but not sufficient. Two checks from 4.4 carry over. Figure 5 shows the full decision.
- How strong is the correlation? Weakly correlated data give poor predictions both ways. At the tree estimates are sensible. At they would be barely better than quoting the mean.
- Is the given value inside the data's range? An estimate between observed values is interpolation. It is fine when is strong. One beyond them is extrapolation, unreliable because nothing says the pattern continues.
- With on , the range that matters is the range of the -values, because is what you substitute. The tree heights run from to . A tree is interpolation.
- A tree is extrapolation. The line would claim , a figure with no data behind it.
- Write: the value lies outside the range of the data used to find the line, so the pattern may not hold. Do not call it an "outlier". That word means a data point far from the rest of the data, which is a different idea.
- The guide's caution (an on line cannot always reliably predict from ) is 4.4's warning turned round.
- Asked to justify your choice of line, write: " is known and is to be estimated, so the line of on is used; the on line minimises vertical distances, so it does not give the best estimate of ."
- A strong line is also not a cause. Height does not produce diameter; both grow as the tree ages.
Practice questions
36 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.