Plotting paired data: explanatory and response variables
You measured two things about each person. How do you draw both at once, so that each person is still one mark you can point to?
Where you are 2 in Scatter plots
When you reach for it
Some questions are about two measurements at once. Do runners who train longer run faster? Do hotter days sell more lemonade? Does a car lose value as it ages? A list of training times and a separate list of run times cannot answer these, because the question is about how the two go together for each runner. That is Bivariate data: two variables recorded on the same individuals.
The picture for it is a scatter plot. Each individual becomes one point on a The coordinate plane, placed across by one measurement and up by the other, so the two numbers that belong together stay together. Saying what the whole cloud of points shows is the next lesson, Describing a scatter plot.
The procedure
One individual, one point. A table of bivariate data has one row per individual and one column per variable, as in Individuals, variables and units. Six students had their arm span (fingertip to fingertip, arms stretched sideways) and their height measured. These numbers are made up.
| Student | Arm span (cm) | Height (cm) | Point |
|---|---|---|---|
| Paloma | 162 | 160 | (162, 160) |
| Quentin | 175 | 177 | (175, 177) |
| Roswitha | 158 | 161 | (158, 161) |
| Sanjeev | 181 | 178 | (181, 178) |
| Tilde | 169 | 166 | (169, 166) |
| Uriah | 172 | 174 | (172, 174) |
Paloma’s row becomes the ordered pair (162, 160): arm span first, height second. Both coordinates come from the same person, so the point is Paloma herself, seen through two measurements. The data are called paired for this reason, and a scatter plot can only be drawn when each value is known to belong with its partner.
Which variable goes across. Often one variable is the one we would use to help explain or predict the other: it is known first, or someone sets it, and the question is how the other goes along with it. That one is the explanatory variable and the other is the response variable. A runner’s hours of training in a week are known before a timed run at the end of the week, and the question is how run times go along with training, so training is explanatory and run time is the response. By convention the explanatory variable goes on the horizontal x-axis and the response on the vertical y-axis, as on a function graph. Some books say independent and dependent variables, the names used for functions in Independent and dependent variables.
The labels say which variable we predict from, not what causes what. Calling temperature explanatory means we look at sales in the light of temperature; it does not claim that heat causes sales, and no scatter plot can show that it does. Settling a question of cause needs the right kind of study (Observational studies and experiments), and a third variable can drive both (Correlation is not causation: lurking and confounding variables).
Sometimes neither variable is the natural one to predict from. Arm span and height are measured at the same moment, nobody sets either, and each predicts the other just as well. Then the choice of axis is arbitrary: either may go across, and you say which you chose.
Scales that fit the data. Each axis gets its own scale, chosen from that variable’s data alone. Find the smallest and largest values, then pick a step (the amount per gridline) so that the data spread over most of the axis, from a gridline just below the smallest value to one just above the largest. The steps must be equal all along an axis, because a point’s position is what carries its value. The two axes may use different steps, since they measure different things.
An axis does not have to start at 0. The arm spans run from 158 to 181, so an axis from 0 would be almost all empty. In a scatter plot a value is read from where the point sits against the scale, not from a length measured up from 0, so the empty stretch can be cut out. The cut is shown by a zigzag break mark near the corner, as on both axes above, so nobody mistakes the corner for 0.
Plotting and reading back. To plot (162, 160), go along the x-axis to 162, then up to the level of 160 on the y-axis, and make a dot. Reading back is the same move reversed: from the dot, straight down to the x-axis for the first value and straight across to the y-axis for the second. The dots are not joined: between Paloma and Tilde there is nobody, and a line would invent people who were never measured. That is the difference from Graphing a function from a table, where every input between the table’s values has an output too.
Worked examples
Which variable is explanatory
For each pair of variables, decide whether one is explanatory, and say which axis each goes on.
(a) A runner’s hours of training in a week, and their time for a 1 km run at the end of that week.
(b) The daily high temperature, and the number of cups of lemonade a stall sells that day.
(c) A student’s arm span, and the same student’s height.
(d) The price Uriah charges per cup of lemonade, and the number of cups he sells that day.
Solution(a) The training is known before the run. Training is explanatory, on the x-axis; run time is the response, on the y-axis.
(b) The forecast high is known in the morning, and a stall owner would use it to guess the day’s sales; nobody predicts the weather from lemonade. Temperature is explanatory, across; cups sold is the response, up.
(c) Both are measured at the same moment and each predicts the other equally well. There is no explanatory variable, and either may go across.
(d) Uriah sets the price before the day starts. Price is explanatory, across; cups sold is the response, up.
Choosing scales for the running data
Eight runners in a club (made-up data) recorded their hours of training in one week and their time for a 1 km run at the end of it, in seconds (s).
| Runner | Training (h) | Time (s) |
|---|---|---|
| 1 | 6 | 312 |
| 2 | 7.5 | 268 |
| 3 | 9 | 251 |
| 4 | 6.5 | 295 |
| 5 | 8 | 262 |
| 6 | 8.5 | 270 |
| 7 | 7 | 284 |
| 8 | 9.5 | 246 |
Choose a scale for each axis.
SolutionFrom Example 1, training goes across and time goes up.
Training runs from 6 to 9.5 hours, a spread of 9.5 - 6 = 3.5 hours, and every value is a whole or half hour. A step of half an hour puts each value exactly on a gridline. Starting one step below the smallest value and ending one step above the largest gives an axis from 5.5 to 10, which is (10 - 5.5) \div 0.5 = 9 squares wide.
Times run from 246 to 312 s, a spread of 312 - 246 = 66 s. Steps of 10 s from 240 (the multiple of 10 just below 246) to 320 (the one just above 312) give (320 - 240) \div 10 = 8 squares. Neither axis starts at 0, so each gets a break mark.
Why not start the time axis at 0? The plot below does. The data fill only 66 of the 350 s on that axis, about a fifth of its height, so the dots huddle in a thin band and the differences between runners almost vanish.
Plotting the running data by hand
Plot the eight runners from Example 2 on the scales chosen there, and check by reading one point back.
SolutionWith 0.5 hours per square starting at 5.5, a training time h sits (h - 5.5) \div 0.5 squares right of the first gridline. With 10 s per square starting at 240, a run time t sits (t - 240) \div 10 squares above the lowest gridline.
| Runner | Point | Across | Up |
|---|---|---|---|
| 1 | (6, 312) | 1 | 7.2 |
| 2 | (7.5, 268) | 4 | 2.8 |
| 3 | (9, 251) | 7 | 1.1 |
| 4 | (6.5, 295) | 2 | 5.5 |
| 5 | (8, 262) | 5 | 2.2 |
| 6 | (8.5, 270) | 6 | 3 |
| 7 | (7, 284) | 3 | 4.4 |
| 8 | (9.5, 246) | 8 | 0.6 |
A value such as 312 s falls between gridlines: it is 2 s past 310, two tenths of the way to 320, so the dot goes a fifth of a square above the 310 line.
To check, take the dot 3 squares across and a little under halfway between the 280 and 290 lines. Straight down reads 5.5 + 3 \times 0.5 = 7 hours, and straight across reads 240 + 4.4 \times 10 = 284 s. That is (7, 284), Runner 7, as in the table.
Reading points back
The plot of Uriah’s seven days is all you have; the table is lost. Answer from the plot.
(a) How many cups were sold on the day the high was 29\,^\circ\text{C}?
(b) What was the high on the day 35 cups were sold?
(c) Find two days on which the hotter day sold fewer cups.
SolutionThere is one gridline per degree and one per 5 cups, and every dot sits on a crossing of gridlines, so each can be read exactly.
(a) Go along the temperature axis to 29, which is 4 gridlines past 25, and up to the dot. Straight across, it is level with the 55 line, one gridline above 50. So 55 cups.
(b) Find the dot level with 35 on the cups axis, halfway between the 30 and 40 labels. Straight down from it reads 26\,^\circ\text{C}, one gridline past 25.
(c) The dots at (24, 40) and (26, 35): the day at 26\,^\circ\text{C} was 2 degrees hotter and sold 40 - 35 = 5 fewer cups. One pair of points says nothing about the trend over all seven days; that is the work of Describing a scatter plot.
When either variable could go across
Use the six students’ arm spans and heights from the procedure.
(a) Where does Paloma’s point go if height is put across and arm span up instead?
(b) The dashed line on the plot joins the points where arm span equals height. How many students are taller than their arm span, and how does the plot show it?
Solution(a) Height is now the first coordinate, so Paloma’s point becomes (160, 162), and every point (a, h) becomes (h, a). Here both axes run from 155 to 185 in steps of 5, with the same length per step, so the swap reflects each dot across the dashed line, the line y = x. If the two axes used different scales, the swapped plot would be stretched as well as flipped. Either way neither plot is more correct, which is what “the choice is arbitrary” means.
(b) A dot above the dashed line is higher than the point of the line directly below it, so that student’s height is greater than their arm span. Quentin (175, 177), Roswitha (158, 161) and Uriah (172, 174) lie above the line: 3 students. The table agrees: 177 > 175, 161 > 158 and 174 > 172, and the other three are shorter than their arm spans.
A car’s age and its price
Sanjeev looked up eight used cars of the same model (made-up data).
| Age (years) | Price (dollars) |
|---|---|
| 1 | 23{,}500 |
| 2 | 21{,}000 |
| 3 | 18{,}500 |
| 4 | 17{,}000 |
| 5 | 14{,}500 |
| 7 | 11{,}000 |
| 9 | 8{,}500 |
| 11 | 6{,}000 |
Plot the data, then find how many of these cars cost no more than 12{,}000 dollars.
SolutionA buyer knows a car’s age and uses it to judge the price, so age is explanatory and goes across.
Measure prices in thousands of dollars, so 23{,}500 dollars is 23.5. The ages run from 1 to 11, so steps of 1 year from 0 to 12 fit. The prices run from 6 to 23.5, so steps of 1 thousand from 0 to 25 fit. Both axes can start at 0: the smallest age is one step from 0 and the smallest price 6 steps, so little room is wasted and no break is needed.
The one-year-old car goes 1 across and 23.5 up, halfway between the 23 and 24 lines. No cars aged 6, 8 or 10 are in the data, so those columns stay empty, one more reason not to join the dots.
The budget is the level 12 on the price axis. The dots at or below it are (7, 11), (9, 8.5) and (11, 6), so 3 cars are affordable, the youngest of them 7 years old.
Boundaries
- Both variables must be numbers on a scale. A categorical variable, such as a car’s color, has no size to place; it needs a two-way table or side-by-side plots (Types of data: categorical, numerical, discrete, continuous).
- The two values must belong to the same individual. Two separate lists, or columns sorted separately, have lost their pairing, and no plot can be drawn from them.
- Explanatory and response say which variable we predict from, not what causes what. When neither is the natural one to predict from, the axis choice is arbitrary.
- Steps are equal along each axis, though the two axes may differ. A break mark removes space only between the corner and the first gridline, never inside the scale.
- A break suits a scatter plot, not a bar graph. In a bar graph a bar’s length from 0 is the value, so cutting the axis would misstate it.
- Two individuals with the same pair land on the same spot. Write a small 2 beside that dot, so the count of dots still matches the count of rows.
Where this goes next
Describing a scatter plot looks at the whole cloud: its direction, form, strength and any points that stand apart. When the cloud runs roughly along a line, the Line of best fit predicts the response from the explanatory variable, which is why that variable went across. Later, Correlation measures how close to a line the points lie, the The least squares criterion and its line picks the best line exactly, and Modeling with linear relationships fits models to data plotted this way.
Exercises
Pairs and the explanatory variable
- A running club of 27 members recorded their 1 km times, but 3 of them did not record their hours of training. How many points can go on a scatter plot of training against time?
For Exercises 2 to 5, say which variable is explanatory, or that the choice is arbitrary, and why.
- Hours spent practicing a piano piece in a week, and the number of wrong notes played in the recital at the end of that week.
- The price of a used car, and the number of kilometers it has been driven.
- A student’s arm span, and the length of the same student’s foot.
- On each day, the number of cups of lemonade and the number of sun hats sold at the same stall.
Choosing scales and plotting
- A second club’s 1 km times run from 412 s to 468 s. Using gridlines every 10 s, from the multiple of 10 just below the smallest value to the one just above the largest, which gridlines start and end the axis, and how many squares tall is it?
- Car prices run from 4{,}500 dollars to 27{,}000 dollars. The price axis starts at 0 dollars with a gridline every 2{,}500 dollars. How many squares does it need to reach the first gridline at or above the largest price, and what is that gridline?
- A ninth runner trained 7.25 hours and ran 1 km in 305 s. On the scales of Example 3, how many squares across and how many squares up does the dot go?
- Paloma ran her own lemonade stall on five days (made-up data): 16\,^\circ\text{C} and 12 cups, 19\,^\circ\text{C} and 18 cups, 23\,^\circ\text{C} and 25 cups, 27\,^\circ\text{C} and 33 cups, 30\,^\circ\text{C} and 41 cups. Choose the axes, use steps of 1\,^\circ\text{C} from 15 and 5 cups from 0, and give each point’s position in squares across and up.
Reading points back
- On the plot of Uriah’s lemonade sales, what was the high on the day 60 cups were sold?
- On the same plot, on how many days were more than 50 cups sold?
- On the plot of Sanjeev’s cars, how many cars cost less than 15{,}000 dollars?
- On the same plot, what is the price of the 4-year-old car, and how old is the car that costs 21{,}000 dollars?
Reasoning
- Sanjeev wrote the eight ages in one list from youngest to oldest and the eight prices in another from cheapest to dearest, then lost the original table. Explain why he can no longer draw the scatter plot, and what the sorted lists would wrongly suggest if read as pairs.
- Explain why the time axis of a scatter plot may start at 240 s with a break mark, while a bar graph of the same run times should start at 0.
- Quentin plots the six students with height across; Roswitha plots them with arm span across. Both use axes from 155 to 185 in steps of 5, with the same length per step. Explain why each dot on Quentin’s plot is the mirror image of the same student’s dot on Roswitha’s, across the line y = x, and which dots would not move at all.
Answers
- 24 points. A point needs both values from the same runner, and 27 - 3 = 24 runners have both.
- Practice is explanatory, wrong notes the response: the practice comes first.
- Kilometers driven is explanatory, price the response: the seller sees the distance before setting the price, and buyers judge the price by it. The order the variables are named in does not decide it.
- Arbitrary. Both are measured at the same moment and each predicts the other as well. Either may go across, as long as the plot says which.
- Arbitrary. Both are counted on the same day and neither is known first; both probably go along with a third thing, hot sunny weather.
- From 410 to 470 s, and (470 - 410) \div 10 = 6 squares.
- 11 squares, ending at 27{,}500 dollars. Ten squares reach only 25{,}000 dollars, below the largest price.
- 3.5 squares across, since (7.25 - 5.5) \div 0.5 = 3.5, and 6.5 squares up, since (305 - 240) \div 10 = 6.5.
- Temperature across, from 15 with a break mark; cups up, from 0 to 45. Across: 1, 4, 8, 12 and 15 squares. Up: 12 \div 5 = 2.4, 18 \div 5 = 3.6, 25 \div 5 = 5, 33 \div 5 = 6.6 and 41 \div 5 = 8.2 squares.
- 31\,^\circ\text{C}, one gridline past the 30 label.
- 3 days: the dots above the 50 line are at 55, 60 and 70 cups.
- 4 cars: the cars aged 5, 7, 9 and 11.
- 17{,}000 dollars; the car at 21{,}000 dollars is 2 years old.
- A point is one car’s age and price together, and sorting each list on its own breaks that link. Read as pairs, the sorted lists put the youngest age beside the cheapest price and the oldest beside the dearest, suggesting that older cars cost more, the opposite of what his cars showed.
- In a scatter plot a value is read from where the dot sits against the scale, so cutting out the empty stretch below 240 changes no value, and the break mark warns that the corner is not 0. In a bar graph the value is the bar’s length from 0; starting at 240 would make a bar for 280 s four times as long as one for 250 s.
- A student with arm span a and height h is (a, h) on Roswitha’s plot and (h, a) on Quentin’s. Because both axes have the same start and the same length per step, the segment joining these points has its midpoint \displaystyle \left(\frac{a + h}{2}, \frac{a + h}{2}\right) on the line y = x and runs at right angles to it, which is what reflecting across that line means. A student with a = h would not move; none of the six is like that.