Unit 2 · Topic 2.2 Beta

Summary Statistics for Two Categorical Variables

3 min read · freeNot practiced

A two-way table holds a lot of counts. Turning them into shares is what lets you answer questions. The trick is that the same count, 45, can be part of three different shares, depending on which total you divide by. This page names the three and shows how to tell which one a question wants.

One table, three totals

Rangers at a state park asked a random sample of 250 visitors two questions: is this your first visit, and what is your main activity today?

Visit typeHikingFishingPicnicTotal
First visit451540100
Returning605436150
Total1056976250

Every share is a count over a total. The table has three kinds of total: the grand total (250), the row totals (100 and 150) and the column totals (105, 69, 76). Each kind gives its own name.

The two-way table of 250 park visitors by visit type and activity, with three cells marked. The joint cell, first visit and hiking, holds 45 of all 250 visitors (0.18). The marginal total for hiking is 105 of 250 (0.42). The conditional share of hikers among first visits is 45 of the 100 first visits (0.45).
Figure 1. The circled cell, the shaded total and the shaded row show the three kinds of share. LevlPrep original diagram.

Joint, marginal and conditional

  • A joint relative frequency is one cell over the grand total. 45250=0.18\frac{45}{250} = 0.18: 18% of all visitors were on a first visit and hiking.
  • A marginal relative frequency is a row or column total over the grand total. 105250=0.42\frac{105}{250} = 0.42: 42% of all visitors hiked. The marginal totals sit in the margins of the table, hence the name. Listing it for every activity (42%, 27.6%, 30.4%) gives the marginal distribution of activity.
  • A conditional relative frequency is one cell over its row or column total. 45100=0.45\frac{45}{100} = 0.45: of the first-time visitors, 45% hiked. Listing it for every activity gives the conditional distribution of activity for first-time visitors.
KindDivideAnswersExample
Jointa cell by the grand total"What share of everyone is both ...?"45250=0.18\frac{45}{250} = 0.18
Marginala total by the grand total"What share of everyone is ...?"105250=0.42\frac{105}{250} = 0.42
Conditionala cell by its group's total"Of those who ..., what share ...?"45100=0.45\frac{45}{100} = 0.45

Finding the group

Conditional questions are where most mistakes happen. Read the question for the group it starts from. That group's total goes on the bottom.

Worked example 1. Find (a) the proportion of returning visitors who came to fish and (b) the proportion of people who fished who were returning visitors.

(a) The group is returning visitors, 150 of them. 54 fished: 54150=0.36\frac{54}{150} = 0.36.

(b) The group is the people who fished, 69 of them. 54 were returning: 5469≈0.783\frac{54}{69} \approx 0.783.

Same cell, 54, but different groups, so different answers. Mixing these two up is the most common slip with two-way tables.

Comparing groups

To compare first-time and returning visitors, compare their conditional distributions:

Visit typeHikingFishingPicnic
First visit (100)45%15%40%
Returning (150)40%36%24%

Each row adds to 100%. The rows differ, most of all for fishing, so visit type and activity are associated in this sample.

Worked example 2. A ranger claims that returning visitors are more likely to come to fish. Use the data to respond.

Compare conditional relative frequencies: 54150=0.36\frac{54}{150} = 0.36 for returning visitors and 15100=0.15\frac{15}{100} = 0.15 for first visits.

The data support the claim for this sample: 36% of returning visitors (54 of 150) came to fish, compared with 15% of first-time visitors (15 of 100). Because the visitors were a random sample, the comparison can be generalized to the park's visitors.

What no association looks like

If visit type made no difference, each row would match the marginal distribution: 42% hiking, 27.6% fishing, 30.4% picnic for both groups. That gives a quick check. Overall 63% of new drivers in a sample passed their road test on the first try. If driver's education were not associated with passing, about 63% of the course takers and about 63% of the others would pass. When the conditional relative frequencies are far from each other, as 75% and 55% are, the variables are associated.

One more fact follows. A marginal relative frequency is a weighted mix of the conditional ones. If 30% of men and 30% of women prefer a window seat, then 30% of everyone does, whatever the numbers of men and women.

Spot a mistake on this page?