Unit 1 · Topic 1.3 Beta

Tabular Representation and Summary Statistics for One Categorical Variable

3 min read · freeNot practiced

A categorical variable sorts individuals into groups. The first way to summarize it is to count: how many individuals are in each group? This page shows how to turn those counts into a frequency table, how to turn the counts into relative frequencies, and what a sample proportion is.

Frequency tables

A frequency table lists each category of a categorical variable with its frequency, the number of individuals in that category. The frequencies add to the total number of individuals, as long as each individual is in exactly one category.

For example, a random sample of 160 adults named their main source of news: 56 social media, 40 television, 36 news websites, 16 radio and 12 print newspapers. Those five counts are the frequencies, and they add to 160.

Relative frequencies

Counts are hard to compare between groups of different sizes. Forty television viewers out of 160 adults is a large share; forty out of 5,000 is tiny. So divide each count by the total. The result is the relative frequency:

relative frequency=count in the categorytotal\text{relative frequency} = \frac{\text{count in the category}}{\text{total}}

Left: 250 students drawn as dots, one dot for every 5 students, in five rows: Bus 95, Car 80, Walk 45, Bike 20, Other 10. Right: the frequency table with each count over 250: Bus 0.38, Car 0.32, Walk 0.18, Bike 0.08, Other 0.04, total 1.00.
Figure 1. Counts in five categories, and the same counts divided by the total of 250. LevlPrep original diagram.

Build the relative frequency table. Use the 160 adults above.

News sourceFrequencyRelative frequency
Social media5656160=0.35\frac{56}{160} = 0.35
Television4040160=0.25\frac{40}{160} = 0.25
News websites3636160=0.225\frac{36}{160} = 0.225
Radio1616160=0.10\frac{16}{160} = 0.10
Print newspaper1212160=0.075\frac{12}{160} = 0.075
Total1601.000

Check: 0.350.35+0.25+ 0.25+0.225+ 0.225+0.10+ 0.10+0.075+ 0.075=1= 1. In context: 35% of the sampled adults get their news mainly from social media.

Three facts follow from the division:

  • Every relative frequency is between 0 and 1 (between 0% and 100%).
  • When each individual is in exactly one category, the relative frequencies add to 1. A "check every one that applies" question breaks this: one person can sit in several categories, so the sum can be more than 1.
  • To get a count back, multiply: count = relative frequency × total. A relative frequency of 0.42 among 400 donors is 0.42×400=1680.42 \times 400 = 168 donors. Without the total you cannot recover the counts.

A missing relative frequency can be found from the others, because they add to 1. If the blood types O, A and B have relative frequencies 0.44, 0.42 and 0.10, then type AB has 1−(0.44+0.42+0.10)1 - (0.44 + 0.42 + 0.10)=0.04= 0.04.

Sample proportion and population proportion

When the data come from a sample, the relative frequency of a category has a name: the sample proportion, written p^\hat{p} and read "p-hat".

p^=number in the sample in the categoryn\hat{p} = \frac{\text{number in the sample in the category}}{n}

Here nn is the sample size. For television, p^=40160=0.25\hat{p} = \frac{40}{160} = 0.25. The sample proportion is a statistic.

The same quantity for the whole population is the population proportion, written pp: the part of every adult in the city whose main source is television. It is a parameter, usually unknown, and p^\hat{p} estimates it. The hat is a reminder that p^\hat{p} is an estimate built from a sample.

Sample proportionPopulation proportion
Symbolp^\hat{p}pp
Describesthe samplethe whole population
Kind of numberstatisticparameter
Known?yes, computed from datausually not

Comparing groups fairly

A second blood bank had 250 donors, 30 with type B. The first had 400 donors, 40 with type B. The counts suggest the first bank, but the relative frequencies say otherwise: 30250=0.12\frac{30}{250} = 0.12 against 40400=0.10\frac{40}{400} = 0.10. Whenever groups have different sizes, compare relative frequencies, and say which is larger in context: "a larger proportion of the second bank’s donors had type B blood."

Spot a mistake on this page?