Resources For Teachers For Tutors For Students & Parents AI New Books Pricing
Year 12 Maths - General (Unit 3 & Unit 4) Investigating associations between two variables

Numerical and categorical variables: back-to-back stem plots, parallel dot plots and boxplots

20 practice questions 0 video lessons Theory + worked examples

Compare groups with boxplots, dot plots and back-to-back stem plots in Year 12 VCE General Mathematics. Do workers who drive into Melbourne really take longer than those who ride or catch the train? When a measurement is split into groups, putting the displays side by side on one scale shows at a glance whether the groups differ.

You will read and build each display, find medians, quartiles, IQRs and outliers using the fences, and decide whether the typical value changes from group to group. You will write clear sentences comparing centre and spread, choose the right display for two or more groups, and then move on to associations between two numerical variables on a scatterplot.

Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

To see whether a numerical variable is associated with a categorical variable, compare its distribution across the categories. This Year 12 General Mathematics guide for students in Victoria shows how to read parallel boxplots, parallel dot plots and back-to-back stem plots, compare medians and spreads, and describe the association in context.

When the explanatory variable is categorical (such as way of travelling) and the response is numerical (such as commute time), we display the response separately for each category, on the same scale, and compare the groups. Three displays are used:

  • a back-to-back stem plot, for exactly two groups: the stems run down the middle, one group’s leaves on each side (leaves on the left get larger moving away from the stem);
  • parallel dot plots, one dot plot per group on a common scale;
  • parallel boxplots, one boxplot per group, built from each group’s five-number summary (minimum, \(Q_1\), median, \(Q_3\), maximum), with any outliers plotted as separate points.

To describe the association, compare the centres (medians) and the spreads (IQR, or range) of the groups. If the medians differ clearly from one category to another, the variables are associated. If the medians are about the same, there is no association, even if the spreads differ.

Key idea. A numerical variable is associated with a categorical variable when its median changes noticeably from one category to the next. Describe it in context: which group tended to be higher, quoting both medians, then compare the IQRs.

A back-to-back stem plot of commute times for workers living in and out of a country town:

In townOut of town
80
8 7 5 4 2 119
6 3 122 5 7 9
431 3 6 8
42 5
Key: 1 | 4 = 14 minutes
Daily bookings at a Daylesford day spaParallel dot plots of bookings on ten weekdays and ten weekend days. Weekday median 16.5, weekend median 22.5. Weekday Weekend 10 12 14 16 18 20 22 24 26 28 30 Bookings per day
Parallel dot plots: weekend bookings (median \(22.5\)) sit clearly to the right of weekday bookings (median \(16.5\)), so the number of bookings is associated with the type of day.
Commute time by way of travellingParallel boxplots. Car: median 33. Train: median 41. Bike: median 25, with an outlier at 45 minutes. Car Train Bike 15 20 25 30 35 40 45 50 55 Commute time (minutes)
Parallel boxplots: the medians differ (bike \(25\), car \(33\), train \(41\) minutes), so commute time is associated with the way of travelling. The bike time of \(45\) minutes is an outlier.

Spread of each group:

\[\text{IQR} = Q_3 - Q_1 \qquad \text{range} = \text{max} - \text{min}\]
IQR=Q3−Q1range=max−min

Fences for outliers on a boxplot (a value beyond a fence is plotted as a separate point):

\[\text{lower fence} = Q_1 - 1.5 \times \text{IQR} \qquad \text{upper fence} = Q_3 + 1.5 \times \text{IQR}\]
lower fence=Q1−1.5×IQRupper fence=Q3+1.5×IQR

Median of \(n\) ordered values: the value in position

\[\dfrac{n + 1}{2}\]
n+12
Quartiles split each group into quarters. About \(25\%\) of a group lies below \(Q_1\), \(50\%\) below the median and \(75\%\) below \(Q_3\). So \(75\%\) of a group lies above its \(Q_1\).

How to describe an association between a numerical and a categorical variable

  1. Identify the variables. The categorical variable is explanatory; the numerical variable is the response.
  2. Choose a display. Two groups: a back-to-back stem plot, parallel dot plots or parallel boxplots. Three or more groups: parallel dot plots or parallel boxplots (a back-to-back stem plot has only two sides).
  3. Find the medians (and the quartiles, IQR or range) of every group. For a boxplot, check the fences for outliers.
  4. Compare centres. Clearly different medians mean the variables are associated; similar medians mean no association.
  5. Compare spreads and write the conclusion in context, quoting the values: “Group A tended to be higher than group B (median \(a\) compared with \(b\)), and was more variable (IQR \(c\) compared with \(d\)).”
Example 1 — Back-to-back stem plot
The back-to-back stem plot shows the commute times, in minutes, of \(11\) Wangaratta workers who live in town and \(11\) who live out of town.
In townOut of town
80
8 7 5 4 2 119
6 3 122 5 7 9
431 3 6 8
42 5
Key: 1 | 4 = 14 minutes
(a) Find the median of each group. (b) Find the range of each group. (c) Is there an association between where a worker lives and commute time?
Solution

With \(n = 11\), the median is the \(6\)th value. Read the left side from the stem outwards.

\(\text{position}\)\(=\)\(\dfrac{11 + 1}{2}\)
\(\)\(=\)\(6\text{th value}\)
\(\text{median (in town)}\)\(=\)\(17\)
\(\text{median (out of town)}\)\(=\)\(31\)
\(\text{range (in town)}\)\(=\)\(34 - 8\)
\(\)\(=\)\(26\)
\(\text{range (out of town)}\)\(=\)\(45 - 19\)
\(\)\(=\)\(26\)

(a) 17 and 31 minutes. (b) Both ranges are 26 minutes. (c) Yes. Workers living out of town tended to have longer commutes (median 31 minutes compared with 17), although the spreads are the same.

Example 2 — Parallel dot plots
A Lakes Entrance fishing charter recorded the number of snapper caught on \(10\) morning trips and \(10\) afternoon trips. (a) Find the median for each session. (b) Describe the association between session and catch.
Snapper caught on morning and afternoon charter tripsParallel dot plots of ten morning and ten afternoon trips. Morning median 4, afternoon median 2. Morning Afternoon 0 1 2 3 4 5 6 7 8 Snapper caught per trip
Solution

With \(n = 10\), the median is halfway between the \(5\)th and \(6\)th values.

\(\text{median (morning)}\)\(=\)\(\dfrac{4 + 4}{2}\)
\(\)\(=\)\(4\)
\(\text{median (afternoon)}\)\(=\)\(\dfrac{2 + 2}{2}\)
\(\)\(=\)\(2\)

(a) Morning 4, afternoon 2 snapper. (b) The catch is associated with the session: morning trips tended to catch more snapper (median 4 compared with 2). Both groups have a range of \(5\).

Example 3 — Boxplots and an outlier
Waiting times (minutes) for a tram were recorded on \(10\) mornings at two Melbourne stops.

Stop A: 3, 4, 4, 5, 6, 6, 7, 8, 9, 18
Stop B: 5, 7, 8, 9, 10, 11, 12, 13, 14, 15

(a) Find the five-number summary for Stop A. (b) Show that \(18\) minutes is an outlier. (c) Compare the two stops.
Solution

Split the \(10\) ordered values into a lower half and an upper half of \(5\) each; the quartiles are their medians.

\(\text{median}\)\(=\)\(\dfrac{6 + 6}{2}\)
\(\)\(=\)\(6\)
\(Q_1\)\(=\)\(\text{median of } 3, 4, 4, 5, 6\)
\(\)\(=\)\(4\)
\(Q_3\)\(=\)\(\text{median of } 6, 7, 8, 9, 18\)
\(\)\(=\)\(8\)
\(\text{IQR}\)\(=\)\(8 - 4\)
\(\)\(=\)\(4\)
\(\text{upper fence}\)\(=\)\(8 + 1.5 \times 4\)
\(\)\(=\)\(14\)
Tram waiting times at two stopsStop A: min 3, Q1 4, median 6, Q3 8, whisker to 9, outlier 18. Stop B: min 5, Q1 8, median 10.5, Q3 13, max 15. Stop A Stop B 0 2 4 6 8 10 12 14 16 18 20 Waiting time (minutes)

(a) Min \(3\), \(Q_1 = 4\), median \(6\), \(Q_3 = 8\), max \(18\). (b) \(18 > 14\), so \(18\) is an outlier: it is drawn as a separate point and the whisker stops at \(9\). (c) Stop B tended to have longer waits (median \(10.5\) minutes compared with \(6\)), and its middle \(50\%\) of waits were a little more spread out (IQR \(5\) compared with \(4\)).

Example 4 — Three groups and a trend
The parallel boxplots show the hours of study per week for students in three year levels at a Geelong school. (a) Find the median and IQR of each group. (b) What percentage of Year \(12\) students study more than \(17\) hours a week? (c) Describe the association between year level and study time.
Weekly study hours by year levelYear 8: min 6, Q1 9, median 12, Q3 15, max 20. Year 10: min 9, Q1 13, median 16, Q3 20, max 25. Year 12: min 12, Q1 17, median 22, Q3 27, max 32. Year 8 Year 10 Year 12 5 10 15 20 25 30 35 Hours of study per week
Solution

Read the median (line in the box) and the box ends (\(Q_1\) and \(Q_3\)) for each year level.

\(\text{IQR (Year 8)}\)\(=\)\(15 - 9\)
\(\)\(=\)\(6\)
\(\text{IQR (Year 10)}\)\(=\)\(20 - 13\)
\(\)\(=\)\(7\)
\(\text{IQR (Year 12)}\)\(=\)\(27 - 17\)
\(\)\(=\)\(10\)
\(17 = Q_1 \text{ (Year 12)}\)\(\Rightarrow\)\(75\% \text{ above}\)

(a) Medians \(12\), \(16\) and \(22\) hours; IQRs \(6\), \(7\) and \(10\) hours. (b) 75%. (c) Study time is associated with year level: the median rises from \(12\) to \(16\) to \(22\) hours as year level increases, and study times also become more variable (IQR \(6\) up to \(10\)).

Common pitfalls

Reading the left side of a stem plot backwards. On a back-to-back stem plot the left-hand leaves increase moving away from the stem. A leaf of \(4\) on the left of stem \(1\) means \(14\), not \(41\).
Overlap does not mean no association. Boxplots that overlap can still show an association: decide by comparing the medians, not by whether the boxes touch.
Different spreads alone are not an association. If the medians are about equal, there is no association, even if one group is more variable. Describe the spread separately.

Frequently asked questions

How do you compare two boxplots?

Compare the medians first: if they differ clearly, the variables are associated. Then compare the spreads using the IQRs or ranges, and mention any outliers. Quote the values in a sentence in context.

When should you use a back-to-back stem plot?

Use it when a numerical variable is compared across exactly two groups. For three or more groups use parallel boxplots or parallel dot plots.

How do you read the left side of a back-to-back stem plot?

The stem is in the middle and the left leaves increase moving away from the stem. A leaf of 4 on the left of stem 1 means 14.

How do you know if there is an association between a numerical and a categorical variable?

Look at the medians of the groups. If the median changes noticeably from one category to another, the variables are associated. If the medians are about the same, there is no association.

How do you find an outlier on a boxplot?

Work out the fences Q1 - 1.5 x IQR and Q3 + 1.5 x IQR. Any value below the lower fence or above the upper fence is an outlier and is plotted as a separate point.

What percentage of data lies above the first quartile?

About 75%. Each quartile marks off a quarter of the data, so 25% lies below Q1 and 75% lies above it.