Explainer: Conditional Probability: Two-Way Tables

In this explainer, we will learn how to deal with the concept of conditional probability using joint frequencies presented in two-way tables.

When collecting data on nonnumerical variables, we count how many times a particular characteristic occurs. We can then put our results in a table. For example, a fanzine site for the TV show AMaze in Space collects data on the number of new alien species encountered each season. The data for seasons 1, 2, and 7 is shown in the table below.

Our population here is “new alien species” and the variable is “season,” which is a categorical (i.e., nonnumerical) variable. In this data set, the variable has 3 categories: season 1, season 2, and season 7. We count the number of new species encountered in each season.

We can delve deeper into the data by splitting it according to which of the two Starships Zeta and Geoda the new species were encountered by. So, the data varies not only across the three seasons, but also with respect to the two starships, as shown in the table below.

Our data is now displayed in a “two-way table” (which is sometimes also called a “contingency table”). The “two” in the two-way table refers to the two variables (which, in our case, are “season” and “starship”). Looking at the table, we can see that, for example, in season 1, 28 new species were encountered by the Starship Geoda, but only 3 by the Starship Zeta.

Example 1: Calculating Probabilities Using a Two-Way Table

A fanzine website for the TV show AMaze in Space collects data on the number of new alien species encountered by two starships in each season of the show. The data for seasons 1, 2, and 7 is shown in the table below, split by the two starships Zeta and Geoda.

Find the probability that a new alien species chosen at random was encountered by Starship Geoda. Give your answer to three decimal places.

Answer

To find the probability that a new species chosen at random was encountered by Starship Geoda, we need to know how many of the new species were encountered by Starship Geoda and how many new species were encountered in total across the three seasons.

The probability that a new species was encountered by Starship Geoda is then 𝑃()==7283=0.867GeodanumberofnewspeciesGeodaencounteredtotalnumberofnewspeciesto3d.p.

Hence, the probability that a new alien species was encountered by Starship Geoda is 0.867 to 3 d.p.

Note

We can also say that, overall, there is a 0.867×100%87% chance a new species were encountered by Geoda.

We can also use the two-way table to examine the relationship between the two variables and to work out conditional probabilities. Let us look at an example of this.

Example 2: Using Two-Way Tables to Examine Relationships between Categorical Variables and Calculate Conditional Probabilities

A fanzine website for the TV show AMaze in Space collects data on the number of new alien species encountered by two starships in each season of the show. The data for seasons 1, 2, and 7 is shown in the table below, split by the two Starships Zeta and Geoda.

Given that a new alien species was encountered in season 7, find the probability that they were encountered by Starship Geoda. Give your answer to three decimal places.

Answer

If we know that a new species was encountered in season 7, we only need to look at the total number of new species encountered in season 7 and work out the proportion of those who were encountered by Starship Geoda. So, we look only at the “season 7” column in our table.

Given that a new species appeared in season 7, the probability that they were encountered by Starship Geoda is then 𝑃()==813=0.615GeodanewspeciesencounteredbyGeodainseason7totalnewspeciesencounteredinseason7to3d.p.

That is, if we know a new species appeared in season 7, there is approximately a 62% chance they were encountered by Starship Geoda (since 0.615×100=61.562). In this example, we have worked out the conditional probability that a new alien species chosen at random was encountered by Starship Geoda, given that they appeared in season 7.

In our next example, we will calculate conditional probabilities using a two-way table.

Example 3: Conditional Probability from a Two-Way Table

The table below contains data from a survey of “core gamers” who were asked whether their preferred gaming platform is “smart phone,” “console,” or “PC.” The gamers are also split by gender.

  1. Find the probability that a core gamer chosen at random prefers using a console. Give you answer to three decimal places.
  2. Given that a core gamer prefers to play using a console, find the probability that they are male. Give your answer to three decimal places.

Answer

Let us first work out the totals for the rows and columns of our table.

Part 1

To find the probability that a core gamer chosen at random prefers using a console, we find the number of gamers who prefer a console and divide by the total number of gamers.

Let C be the number of gamers who prefer a console; then, 𝑃()==60243=0.247Cnumberofgamerspreferringconsoletotalnumberofgamersto3d.p.

As a percentage, this is 0.247×100=24.7%25%. Hence, approximately 25% of gamers prefer to use a console.

Part 2

Given that a core gamer prefers to play using a console, we want to find the probability that they are male. Because we are only now interested in gamers who prefer a console, those who prefer to use smart phones or PCs do not figure in this calculation. So we only need to look at the “console” row in the table (highlighted in blue).