Two-Way Frequency Tables
Does studying more the night before a quiz mean a higher score? Ms. Alvarez gave her 30 Algebra 1 students a short quiz graded $6$, $8$, or $10$, and she asked each student how many hours they studied ($1$, $2$, or $3$). One number per student is not enough: to see a relationship, you need both numbers for each student, together. A two-way frequency table does exactly that.
Two variables, one table
Each inner cell is a joint frequency $f_{ij}$: how many individuals have $X = x_i$ and $Y = y_j$ at the same time. The first index $i$ is the row, the second index $j$ is the column.
In a survey of $20$ students, they were asked about the number of siblings ($X$) and the number of pets ($Y$). The results are collected in the following two-way table:…
In a survey of $20$ students, they were asked about the number of siblings ($X$) and the number of pets ($Y$). The results are collected in the following two-way table:
| $X \setminus Y$ | $0$ | $1$ | $2$ |
|---|---|---|---|
| 0 | $2$ | $4$ | $1$ |
| 1 | $3$ | $5$ | $2$ |
| 2 | $1$ | $1$ | $1$ |
State how many students have exactly $1$ sibling and $2$ pets, and check that the sum of all the joint frequencies coincides with the total number of students surveyed.
Building the table from pairs
Often the data do not come in a table. You get a list of pairs, one per individual, and you have to count how many times each pair appears.
$10$ people were asked about the number of times they go to the movie theater per month ($X$) and the number of books they read per month ($Y$). The answers obtained for…
$10$ people were asked about the number of times they go to the movie theater per month ($X$) and the number of books they read per month ($Y$). The answers obtained for each individual $(X,Y)$ were:
$(1, 0), (2, 1), (1, 0), (3, 2), (2, 1), (1, 1), (3, 2), (2, 0), (1, 0), (2, 1)$.
Construct the two-way table corresponding to these two variables, indicating the joint absolute frequencies.
In a study on families, the number of cars ($X$) and the number of bicycles ($Y$) have been recorded. We know that the variable $X$ takes the values $0, 1, 2$ and the…
In a study on families, the number of cars ($X$) and the number of bicycles ($Y$) have been recorded. We know that the variable $X$ takes the values $0, 1, 2$ and the variable $Y$ takes the values $0, 1$. Construct the two-way table knowing that:
-
There are $2$ families with $(0,0)$ and $3$ families with $(0,1)$.
-
There are $4$ families with $(1,0)$ and $5$ families with $(1,1)$.
-
There is $1$ family with $(2,0)$ and $0$ families with $(2,1)$.
Given the following marginal distribution of the variable $X$ with absolute frequencies $f_i$: | $X$ | $1$ | $2$ | $3$ | |:---:|:---:|:---:|:---:| | $f_i$ | $4$ | $5$ |…
Given the following marginal distribution of the variable $X$ with absolute frequencies $f_i$:
| $X$ | $1$ | $2$ | $3$ |
|---|---|---|---|
| $f_i$ | $4$ | $5$ | $1$ |
If we know that the variable $Y$ only takes the value $Y=2$ for all individuals in the sample, construct the complete two-way table for the joint distribution of $(X,Y)$.
The scatter plot with frequencies
The same information can be drawn as a scatter plot: each pair $(x_i, y_j)$ is a point in the coordinate plane. When several individuals share the same pair, they land on the same point, so we write the frequency next to it (or draw a bigger circle).
To turn a plot like this into a table, read each circle: its horizontal position gives the row, its vertical position gives the column, and its number is $f_{ij}$. A missing circle means the cell is $0$. Here there is no circle at $(3, 6)$, so $f_{31} = 0$, exactly as in Ms. Alvarez's table.
The following scatter graph shows the scores obtained in two aptitude tests, $X$ and $Y$, by a group of candidates. The numbers inside the circles indicate the joint…
The following scatter graph shows the scores obtained in two aptitude tests, $X$ and $Y$, by a group of candidates. The numbers inside the circles indicate the joint absolute frequency (the number of candidates who obtained that pair of scores). Construct the two-way table associated with this graph and calculate the marginal mean of test $X$.
Totals and marginal distributions
If you add each row, you get a row total $f_{i\bullet}$. If you add each column, you get a column total $f_{\bullet j}$. They are written in the margins of the table, which is why they are called marginal frequencies.
The marginal distribution of $X$ is the list of the values of $X$ with their row totals $f_{i\bullet}$. The marginal distribution of $Y$ is the list of the values of $Y$ with their column totals $f_{\bullet j}$. It is the ordinary one-variable frequency table you already know, with the other variable ignored.
Given the following joint frequency table that relates the math grades ($X$) and the physics grades ($Y$) of a group of students: | $X \setminus Y$ | $5$ | $6$ | $7$ |…
Given the following joint frequency table that relates the math grades ($X$) and the physics grades ($Y$) of a group of students:
| $X \setminus Y$ | $5$ | $6$ | $7$ |
|---|---|---|---|
| 5 | $4$ | $2$ | $0$ |
| 6 | $1$ | $5$ | $3$ |
| 7 | $0$ | $2$ | $6$ |
Write the marginal distribution table for the variable $X$ (math grades), indicating each value of $X$ and its corresponding marginal frequency $f_{i\bullet}$.
From the same table as the previous exercise, which relates the math ($X$) and physics ($Y$) grades: | $X \setminus Y$ | $5$ | $6$ | $7$ | |:---:|:---:|:---:|:---:| | 5…
From the same table as the previous exercise, which relates the math ($X$) and physics ($Y$) grades:
| $X \setminus Y$ | $5$ | $6$ | $7$ |
|---|---|---|---|
| 5 | $4$ | $2$ | $0$ |
| 6 | $1$ | $5$ | $3$ |
| 7 | $0$ | $2$ | $6$ |
Write the marginal distribution table for the variable $Y$ (physics grades), indicating each value of $Y$ and its marginal frequency $f_{\bullet j}$.
Complete the marginal totals (rows and columns) of the following contingency table that relates the number of daily study hours ($X$) and the number of failed subjects…
Complete the marginal totals (rows and columns) of the following contingency table that relates the number of daily study hours ($X$) and the number of failed subjects ($Y$):
| $X \setminus Y$ | $0$ | $1$ | $2$ | Total $X$ |
|---|---|---|---|---|
| 1 | $1$ | $3$ | $2$ | |
| 2 | $4$ | $1$ | $0$ | |
| 3 | $0$ | $2$ | $2$ | |
| Total $Y$ |
Copy the table into your notebook and fill in the empty cells with the corresponding sums.
Mean and spread of a marginal distribution
A marginal distribution is a normal frequency table, so you find its mean and standard deviation the usual way. The "frequencies" are the marginal totals and the sample size is $N$.
When a variable is grouped in intervals, use the class midpoint $\dfrac{a+b}{2}$ of each interval as its value $x_i$.
The following table relates the amount of fertilizer in ounces ($X$) and the height of the plant in inches ($Y$) after one month of growth: | $X \setminus Y$ | $10$ |…
The following table relates the amount of fertilizer in ounces ($X$) and the height of the plant in inches ($Y$) after one month of growth:
| $X \setminus Y$ | $10$ | $15$ | $20$ |
|---|---|---|---|
| 5 | $2$ | $4$ | $1$ |
| 10 | $1$ | $5$ | $3$ |
| 15 | $0$ | $2$ | $6$ |
Calculate the marginal distribution of the height of the plants ($Y$) and find its marginal arithmetic mean $\bar{y}$.
The heights in inches ($X$) and the number of medals won ($Y$) by a group of athletes have been recorded in the following table, with the variable $X$ grouped into…
The heights in inches ($X$) and the number of medals won ($Y$) by a group of athletes have been recorded in the following table, with the variable $X$ grouped into intervals:
| $X \setminus Y$ | $0$ | $1$ | $2$ |
|---|---|---|---|
| $[160, 170)$ | $6$ | $3$ | $1$ |
| $[170, 180)$ | $4$ | $8$ | $2$ |
| $[180, 190)$ | $2$ | $5$ | $9$ |
Obtain the marginal distribution of the heights ($X$) and calculate its marginal arithmetic mean $\bar{x}$, using the class midpoints of each interval.
Given the following two-way table on the number of rainy days per week ($X$) and the number of daily traffic accidents ($Y$) in a city: | $X \setminus Y$ | $0$ | $1$ |…
Given the following two-way table on the number of rainy days per week ($X$) and the number of daily traffic accidents ($Y$) in a city:
| $X \setminus Y$ | $0$ | $1$ | $2$ |
|---|---|---|---|
| 1 | $10$ | $4$ | $1$ |
| 2 | $5$ | $8$ | $2$ |
| 3 | $2$ | $6$ | $12$ |
Calculate the marginal variance of the variable $Y$ (traffic accidents).
Finding missing cells
Sometimes some cells are erased but the totals survive. Every row and every column must add up to its total, so you can recover what is missing.
When there are two unknowns and only $N$ and a mean are given, write a system of linear equations: one equation from $N$ and one from the mean.
A two-way table shows the relationship between the number of goals scored ($X$) and the goals conceded ($Y$) by a soccer team in several matches. Some inner cells have…
A two-way table shows the relationship between the number of goals scored ($X$) and the goals conceded ($Y$) by a soccer team in several matches. Some inner cells have been erased, but the marginal totals are preserved.
| $X \setminus Y$ | $0$ | $1$ | $2$ | Total $X$ |
|---|---|---|---|---|
| 0 | $2$ | $a$ | $0$ | $5$ |
| 1 | $b$ | $3$ | $1$ | $8$ |
| 2 | $1$ | $1$ | $c$ | $4$ |
| Total $Y$ | $7$ | $7$ | $3$ | $17$ |
Calculate the unknown values $a$, $b$, and $c$ so that the table is consistent.
In a two-way table relating two variables $X$ and $Y$, the cell frequency for $X=2$ and $Y=3$ is an unknown value $k$. | $X \setminus Y$ | $1$ | $2$ | $3$ |…
In a two-way table relating two variables $X$ and $Y$, the cell frequency for $X=2$ and $Y=3$ is an unknown value $k$.
| $X \setminus Y$ | $1$ | $2$ | $3$ |
|---|---|---|---|
| 1 | $4$ | $5$ | $2$ |
| 2 | $1$ | $3$ | $k$ |
| 3 | $2$ | $6$ | $1$ |
If we know that the total sample size is $N=30$, determine the value of $k$ and then calculate the marginal standard deviation of the variable $X$.
The following table relates the weekly training hours ($X$) and the time in a race in minutes ($Y$). Two joint absolute frequencies, $a$ and $b$, are unknown. |…
The following table relates the weekly training hours ($X$) and the time in a race in minutes ($Y$). Two joint absolute frequencies, $a$ and $b$, are unknown.
| $X \setminus Y$ | $15$ | $20$ | $25$ |
|---|---|---|---|
| 2 | $4$ | $2$ | $1$ |
| 4 | $a$ | $5$ | $3$ |
| 6 | $1$ | $b$ | $4$ |
We know that there are $N=40$ athletes in total in the study and that the marginal mean of training hours is $\bar{x} = 4,25$. Set up a system of linear equations and find the exact values of $a$ and $b$.
Conditional distributions
What did the students who studied exactly $3$ hours score? Now you ignore every other row and look at only one row of the table. That row is the conditional distribution of $Y$ given $X = 3$. Its total is not $N$ but the row total $f_{3\bullet}$.
The following table shows the relationship between the age of several young people ($X$) and the number of hours they spend playing sports per week ($Y$): |…
The following table shows the relationship between the age of several young people ($X$) and the number of hours they spend playing sports per week ($Y$):
| $X \setminus Y$ | $2$ | $4$ | $6$ |
|---|---|---|---|
| 14 | $5$ | $3$ | $1$ |
| 15 | $2$ | $6$ | $4$ |
| 16 | $1$ | $2$ | $5$ |
Write down the conditional distribution of the number of hours of sports ($Y$) for the young people who are exactly $15$ years old ($X=15$).
Using the table from the previous exercise on fertilizer ($X$) and height ($Y$): | $X \setminus Y$ | $10$ | $15$ | $20$ | |:---:|:---:|:---:|:---:| | 5 | $2$ | $4$ | $1$…
Using the table from the previous exercise on fertilizer ($X$) and height ($Y$):
| $X \setminus Y$ | $10$ | $15$ | $20$ |
|---|---|---|---|
| 5 | $2$ | $4$ | $1$ |
| 10 | $1$ | $5$ | $3$ |
| 15 | $0$ | $2$ | $6$ |
Calculate the conditional mean of the height of the plants knowing that exactly $10\text{ g}$ of fertilizer was applied to them (that is, calculate $\bar{y}_{X=10}$).
From the same data as the previous exercise on rainy days ($X$) and accidents ($Y$): | $X \setminus Y$ | $0$ | $1$ | $2$ | |:---:|:---:|:---:|:---:| | 1 | $10$ | $4$ |…
From the same data as the previous exercise on rainy days ($X$) and accidents ($Y$):
| $X \setminus Y$ | $0$ | $1$ | $2$ |
|---|---|---|---|
| 1 | $10$ | $4$ | $1$ |
| 2 | $5$ | $8$ | $2$ |
| 3 | $2$ | $6$ | $12$ |
Calculate the conditional variance of the number of traffic accidents ($Y$) when the number of rainy days is exactly $X=3$.
Relative frequencies and percentages
Counts become percentages when you divide by a total. The key question is always: percent of what group?
Same cell, two different answers, because the denominator changed.
An economic study relates the monthly income level in thousands of dollars ($X$) and the leisure expenditure in hundreds of dollars ($Y$) of several families. |…
An economic study relates the monthly income level in thousands of dollars ($X$) and the leisure expenditure in hundreds of dollars ($Y$) of several families.
| $X \setminus Y$ | $1$ | $2$ | $3$ |
|---|---|---|---|
| 1 | $12$ | $6$ | $2$ |
| 2 | $5$ | $10$ | $5$ |
| 3 | $1$ | $4$ | $5$ |
Answer the following questions by calculating the corresponding percentages:
- a) What percentage of the total surveyed families has an income of $2$ thousand dollars and spends $3$ hundred dollars on leisure?
- b) What percentage of the families that earn $3$ thousand dollars spend $2$ hundred dollars on leisure?
A packaging machine classifies products according to their weight in ounces ($X$) and their length in inches ($Y$). Instead of the absolute frequencies, the following…
A packaging machine classifies products according to their weight in ounces ($X$) and their length in inches ($Y$). Instead of the absolute frequencies, the following table of joint relative frequencies $h_{ij} = \frac{f_{ij}}{N}$ is provided:
| $X \setminus Y$ | $10$ | $20$ | $30$ |
|---|---|---|---|
| 100 | $0,10$ | $0,20$ | $0,15$ |
| 200 | $0,05$ | $0,30$ | $0,20$ |
If we know that the marginal absolute frequency for products weighing $100\text{ oz}$ is $f_{100\bullet} = 45$, determine the total number of evaluated products $N$ and reconstruct the table of joint absolute frequencies $f_{ij}$.
Reconstruct a two-way table for the variables $X$ (number of breakdowns in a machine) and $Y$ (production line: $1$ or $2$). The following data is known: The marginal…
Reconstruct a two-way table for the variables $X$ (number of breakdowns in a machine) and $Y$ (production line: $1$ or $2$). The following data is known:
-
The marginal distribution of $X$ takes the values $0, 1, 2$ with marginal frequencies $f_{0\bullet} = 20$, $f_{1\bullet} = 15$ and $f_{2\bullet} = 5$.
-
The conditional distribution of $Y$ given $X=0$ is equiprobable (half of the breakdowns correspond to line $1$ and the other half to line $2$).
-
For $X=1$, twice as many breakdowns occur on line $1$ as on line $2$.
-
For $X=2$, all breakdowns occur on line $2$.
Draw the two-way table with all the joint absolute frequencies $f_{ij}$.
Covariance
Do $X$ and $Y$ tend to rise together? Covariance measures that with one number from the whole table.
For grouped data in both variables, replace every interval by its midpoint and then use the same formula.
Given the following two-dimensional contingency table for the discrete variables $X$ and $Y$: | $X \setminus Y$ | $2$ | $4$ | $6$ | |:---:|:---:|:---:|:---:| | 10 | $1$…
Given the following two-dimensional contingency table for the discrete variables $X$ and $Y$:
| $X \setminus Y$ | $2$ | $4$ | $6$ |
|---|---|---|---|
| 10 | $1$ | $3$ | $0$ |
| 20 | $2$ | $5$ | $2$ |
| 30 | $0$ | $2$ | $5$ |
Calculate the covariance $\sigma_{xy}$ of the joint distribution. Remember that the formula for the covariance is $\sigma_{xy} = \frac{\sum x_i y_j f_{ij}}{N} - \bar{x}\bar{y}$.
An economic study groups both the variable $X$ (advertising expenditure in thousands of dollars) and the variable $Y$ (sales in thousands of dollars) into class…
An economic study groups both the variable $X$ (advertising expenditure in thousands of dollars) and the variable $Y$ (sales in thousands of dollars) into class intervals.
| $X \setminus Y$ | $[10, 20)$ | $[20, 30)$ | $[30, 40)$ |
|---|---|---|---|
| $[0, 2)$ | $2$ | $5$ | $1$ |
| $[2, 4)$ | $3$ | $8$ | $4$ |
| $[4, 6)$ | $0$ | $2$ | $5$ |
Using the class midpoints of each interval, calculate the marginal means $\bar{x}$ and $\bar{y}$, and the covariance of the two-dimensional distribution.
A new variable and weighted means
You can build a new one-variable distribution from a two-way table. For a variable like $Z = X + Y$, compute the value of $Z$ in every cell, then add the frequencies of cells that give the same value.
Another useful fact: the marginal mean is the weighted average of the conditional means, with the row totals as weights.
In a class, the scores obtained on the first exam ($X$) and on the second exam ($Y$) are recorded in the following two-way table: | $X \setminus Y$ | $4$ | $6$ | $8$ |…
In a class, the scores obtained on the first exam ($X$) and on the second exam ($Y$) are recorded in the following two-way table:
| $X \setminus Y$ | $4$ | $6$ | $8$ |
|---|---|---|---|
| 4 | $2$ | $3$ | $0$ |
| 6 | $1$ | $5$ | $2$ |
| 8 | $0$ | $1$ | $6$ |
A new one-dimensional variable $Z = X + Y$ is defined, representing the sum of the scores from both exams. From the two-dimensional table, construct the absolute frequency table of the variable $Z$ and calculate its arithmetic mean $\bar{z}$.
Prove numerically a fundamental property of conditional means using the following table: | $X \setminus Y$ | $1$ | $3$ | $5$ | |:---:|:---:|:---:|:---:| | 2 | $3$ | $1$…
Prove numerically a fundamental property of conditional means using the following table:
| $X \setminus Y$ | $1$ | $3$ | $5$ |
|---|---|---|---|
| 2 | $3$ | $1$ | $0$ |
| 4 | $1$ | $4$ | $1$ |
| 6 | $0$ | $2$ | $8$ |
First, calculate the conditional means of $Y$ for each value of $X$: $\bar{y}_{X=2}$, $\bar{y}_{X=4}$ and $\bar{y}_{X=6}$. Then, calculate the marginal mean $\bar{y}$ and check that the weighted mean relationship is satisfied: $\bar{y} = \frac{\sum \bar{y}_{X=x_i} \cdot f_{i\bullet}}{N}$.
Back to the beginning: does more study time go with higher scores? The conditional means say yes: $\bar{y}_{X=1} \approx 7.11$, $\bar{y}_{X=2} \approx 8.33$, $\bar{y}_{X=3} \approx 9.56$, and the covariance is positive. A two-way table makes that visible, but it describes an association in this class, not proof that studying causes higher scores.