Back to homeMathematics · Integrated Math I · Change subject
Start for free
Math I · Mathematics
Statistics · Bivariate statistics

Two-Way Frequency Tables

Does studying more the night before a quiz mean a higher score? Ms. Alvarez gave her 30 Integrated Math I 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.

Two-way table of hours studied and quiz score with the cell for 2 hours and a score of 8 highlighted Y (quiz score) X (hours) 6810 123 531 264 027 f₂₂ = 6 students: 2 hours studied, score of 8
Practice★☆☆Not started
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.

Solve

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.

Practice★☆☆Not started
$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.

Solve
Practice★☆☆Not started
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)$.

Solve
Practice★☆☆Not started
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)$.

Solve

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).

Scatter plot of hours studied against quiz score; each circle is labeled with the number of students at that pair X (hours studied) Y (score) 6 8 10 123 5 3 1 2 6 4 2 7 the number in each circle is the joint frequency

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.

Practice★★☆Not started
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$.

X Y 1 2 3 1 2 3 3 1 2 4 1 2 5
Solve

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.

Two-way table with a column of row totals, a row of column totals, and the grand total of 30 in the corner Y (score) X (hours) 6810Total 123Total 5319 26412 0279 7111230 blue: row totals orange: column totals green: N = 30

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.

Practice★☆☆Not started
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}$.

Solve
Practice★☆☆Not started
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}$.

Solve
Practice★☆☆Not started
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.

Solve

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$.

Practice★★☆Not started
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}$.

Solve
Practice★★☆Not started
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.

Solve
Practice★★☆Not started
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).

Solve

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.

Practice★★☆Not started
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.

Solve
Practice★★★Not started
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$.

Solve
Practice★★★Not started
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$.

Solve

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}$.

Bar chart of the quiz scores of the 9 students who studied 3 hours: no one scored 6, two scored 8, seven scored 10 0 2 7 6 8 10 scores of the 9 students who studied 3 hours
Practice★☆☆Not started
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$).

Solve
Practice★★☆Not started
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}$).

Solve
Practice★★☆Not started
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$.

Solve

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.

Practice★★☆Not started
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:

  1. a) What percentage of the total surveyed families has an income of $2$ thousand dollars and spends $3$ hundred dollars on leisure?
  2. b) What percentage of the families that earn $3$ thousand dollars spend $2$ hundred dollars on leisure?
Solve
Practice★★★Not started
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}$.

Solve
Practice★★★Not started
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}$.

Solve

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.

Practice★★★Not started
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}$.

Solve
Practice★★★Not started
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.

Solve

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.

Practice★★★Not started
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}$.

Solve
Practice★★★Not started
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}$.

Solve

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.

Summary

See all the exercises in this section