Lesson 1 of 8 · 10 min
Bivariate data: two variables at once
Recognise bivariate data, classify each variable as categorical or numerical, choose a two-way table or a scatterplot, and name the explanatory and response variables.
What you will be able to do
- Explain what makes a data set bivariate.
- Classify each variable in a pair as categorical or numerical, and choose a two-way frequency table or a scatterplot.
- Identify the explanatory variable and the response variable in a context.
In Unit 2 you analysed one variable at a time: the heights of a class, or the waiting times at a clinic. That is univariate data.
Many of the questions people actually ask involve two variables. Do students who live further away take longer to get to school? Do older people get their news from different places from younger people? To answer questions like these, you need both values for each individual.
Definition
Bivariate data
Bivariate data records two variables for each individual — each person, day, car or suburb. Every individual gives a pair of values, and the pairing is what lets you look for an association: a pattern linking the two variables.
| Student | Year level | Travel mode | Distance (km) | Travel time (min) |
|---|---|---|---|---|
| Ava | 11 | Walk | 0.8 | 10 |
| Ben | 12 | Bus | 3.0 | 15 |
| Chloe | 11 | Car | 4.5 | 13 |
| Dev | 12 | Bike | 2.2 | 9 |
| Ella | 11 | Bus | 6.0 | 22 |
| Finn | 12 | Car | 8.5 | 18 |
Any two columns of this table form bivariate data, because both values in each pair belong to the same student. Year level and travel mode is bivariate. Distance and travel time is bivariate. The travel times on their own are univariate.
Here are the distances and travel times for these six students and four more from the same survey. Each student becomes one point.
Each point is one student: two values, one dot. Ben travels 3.0 km in 15 minutes.
Key idea
The type of variable decides the tool
- Both categorical (year level and travel mode): organise the counts in a two-way frequency table and compare percentages. That's the next three lessons.
- Both numerical (distance and travel time): draw a scatterplot. That's the last four lessons.
One of each, like year level and travel time, is a comparison of groups — the parallel box plots you used in Unit 2.
Common mistake
Numbers that are really labels
A postcode, a jersey number or a phone number is made of digits, but it is a categorical variable: it names a category, and an average postcode means nothing. Ask yourself whether it makes sense to calculate a mean. If it doesn't, the variable is categorical.
Which of these data sets is bivariate?
With bivariate data, one variable often helps to explain or predict the other. A hotter day might sell more ice-creams; an older car is usually worth less. Naming the roles of the two variables tells you how to set up the analysis.
Definition
Explanatory and response variables
The explanatory variable is the one that may explain, influence or be used to predict the other.
The response variable is the one that may respond to changes in the explanatory variable.
On a scatterplot, the explanatory variable goes on the horizontal axis and the response variable on the vertical axis.
| Pair of variables | Explanatory variable | Response variable |
|---|---|---|
| Daily maximum temperature and ice-creams sold | Temperature | Ice-creams sold |
| The resale value of a car and its age | Age of the car | Resale value |
| Distance of a taxi trip and the fare | Distance | Fare |
| Age group and main news source | Age group | Main news source |
Tip
Three questions to find the explanatory variable
Which variable could influence the other? Which one would you know first? Which one would you use to predict the other? The answer to all three is the explanatory variable.
The order the variables are named in tells you nothing — in the second row of the table, the response variable is named first.
Worked example
Classify the variables and choose the display
A health researcher records four variables for each of 500 Queensland adults:
- age group (18–34, 35–54, 55 and over)
- whether they had a flu vaccination this year (yes or no)
- hours of exercise in a typical week
- resting heart rate (beats per minute).
(a) Classify each variable as categorical or numerical.
(b) Which display would you use to look for an association between age group and flu vaccination? And between weekly exercise and resting heart rate?
(c) For the second pair, identify the explanatory and response variables.
Step 1: Classify each variable
Age group and flu vaccination take categories as their values, so they are categorical. (Age group is ordinal: its categories have an order.) Hours of exercise and resting heart rate are measurements, so they are numerical.
Ask whether a mean makes sense. A mean number of hours of exercise does; a mean of "yes" and "no" doesn't.
Step 2: Choose the display for the categorical pair
Age group and flu vaccination are both categorical, so count the adults in each combination in a two-way frequency table.
Step 3: Choose the display for the numerical pair
Weekly exercise and resting heart rate are both numerical, so plot one point for each adult on a scatterplot.
Step 4: Decide which variable explains the other
Regular exercise can lower a person's resting heart rate, but resting heart rate doesn't set how much someone exercises. So hours of exercise is the explanatory variable and resting heart rate is the response variable.
The explanatory variable is the one that could influence, or be used to predict, the other.
Try it yourself first, then check the working one step at a time.
Answer
(a) Age group and flu vaccination are categorical; hours of exercise and resting heart rate are numerical. (b) A two-way frequency table for age group and flu vaccination; a scatterplot for exercise and resting heart rate. (c) Hours of exercise is the explanatory variable and resting heart rate is the response variable.
Method
Classify each variable as categorical (labels) or numerical (counts and measurements).
Two categorical variables go in a two-way frequency table; two numerical variables go on a scatterplot.
The explanatory variable is the one that could influence or predict the other.
Watch out for
Calling age group numerical because its categories contain numbers. The values 18–34, 35–54 and 55+ are labels for groups.
A household records the number of hours of sunshine each day and the electricity its solar panels generate that day. Which is the explanatory variable?
Note
When neither variable causes the other
Height and arm span are linked, but neither causes the other. When that happens, the explanatory variable is the one you plan to predict from: to estimate arm span from height, height is explanatory.
Summary
Bivariate data records two variables for each individual, so the data comes in pairs.
Two categorical variables go in a two-way frequency table; two numerical variables go on a scatterplot.
A number used as a label, like a postcode, is categorical.
The explanatory variable may explain or predict the response variable. Decide from the context, not from the order the variables are named.
Finished the lesson?
Try the 2 quick checks above and the lesson completes itself, or mark it complete now.