Track 2 · Describing Data · Lesson 1 of 11
Frequency and relative frequency
Build and read frequency, relative-frequency and cumulative-frequency tables, including simple two-way tables.
A retail operations manager asks: how do our customers pay? Before any chart or average, the honest first answer is a count — how many baskets were paid by card, by cash, by mobile wallet — and what share of the total each one is.
A frequency table lists each possible value (or category) of a variable and how many observations take it. That count is the frequency. It is the simplest summary there is, and for categorical data it is often the only one you need.
Counts depend on how much data you have: 300 card payments means something different out of 400 baskets than out of 4 000. Dividing each count by the total gives the relative frequency — a proportion between 0 and 1, or a percentage when multiplied by 100. Relative frequencies always add up to 1 (100%), apart from rounding.
- the frequency (count) of the -th value or category
- the total number of observations,
- the cumulative frequency: how many observations fall in the first categories, counting in order
Cumulative frequency adds the counts up as you move down the table, so it answers how many are at most this value? That only makes sense when the values have a natural order — numbers of items, ratings, age groups. For unordered categories such as payment method or city, a running total depends on the arbitrary order you happened to list them in, so it has no meaning.
Worked example
Items per basket
A shop recorded the number of items in 20 baskets: 1, 3, 2, 2, 4, 1, 3, 2, 5, 2, 3, 1, 2, 4, 2, 3, 6, 2, 3, 4. Build the frequency table and find the percentage of baskets with at most 3 items.
List the values in order and tally: 1 item → 3 baskets, 2 → 7, 3 → 5, 4 → 3, 5 → 1, 6 → 1. Check: ✓.
Relative frequencies divide by : 0.15, 0.35, 0.25, 0.15, 0.05, 0.05 (they add to 1).
Cumulative frequencies add as you go: 3, 10, 15, 18, 19, 20. The last one must equal .
At most 3 items is the cumulative frequency at 3: , so , i.e. 75% of baskets.
75% of the baskets contain at most 3 items; the most common basket has 2 items (35%).
Show the data as a table
| Travel mode | Count |
|---|---|
| car | 105 |
| bus | 35 |
| metro | 57 |
| bike | 20 |
| walk | 23 |
| Mode | Frequency | Relative frequency | Percentage |
|---|---|---|---|
| car | 105 | 0.4375 | 43.8% |
| metro | 57 | 0.2375 | 23.8% |
| bus | 35 | 0.1458 | 14.6% |
| walk | 23 | 0.0958 | 9.6% |
| bike | 20 | 0.0833 | 8.3% |
| Total | 240 | 1.0000 | 100% |
Dataset
Retail transactions
1,500 rows · one row = one transaction (basket) · synthetic data
| Store | Customer type | Payment method | Items (items) | Basket value (SAR) |
|---|---|---|---|---|
| University | returning | card | 6 | 129.86 |
| Harbour Mall | returning | mobile_wallet | 2 | 60.64 |
| Downtown | new | cash | 1 | 14.65 |
| Airport Road | returning | card | 1 | 6.95 |
| Airport Road | returning | mobile_wallet | 2 | 63.04 |
| Airport Road | new | card | 1 | 34.84 |
Each row is one basket. Count the rows in each category of payment_method to build its frequency table.
Two-way tables. To see how two categorical variables relate, count every combination. The table below cross-tabulates shift and travel mode for the 240 employees. Each cell is a joint frequency; the totals in the margins are the ordinary one-way frequency tables (marginal frequencies).
| Shift | car | metro | bus | walk | bike | Total |
|---|---|---|---|---|---|---|
| morning | 44 | 30 | 18 | 9 | 8 | 109 |
| day | 48 | 17 | 15 | 11 | 9 | 100 |
| evening | 13 | 10 | 2 | 3 | 3 | 31 |
| Total | 105 | 57 | 35 | 23 | 20 | 240 |
A cell can be turned into three different percentages, and they answer three different questions. Take the 44 morning-shift drivers:
- of everyone: of all employees are morning-shift drivers (joint percentage);
- of the row: of morning-shift employees drive (row percentage);
- of the column: of drivers work the morning shift (column percentage).
To compare groups, divide by the size of each group: to compare how the shifts travel, use row percentages.
Quick check
Of 109 morning-shift employees, 30 use the metro; 57 employees use the metro overall. Which statement is correct?
Exercises
The lesson is complete when every exercise is answered correctly. Hints are free; viewing a worked solution before solving means the exercise won't count towards mastery.
0 of 8 exercises correct (not saved — sign in to keep your progress)
Exercise 1 · Guided, difficulty 1 of 3
Build a frequency table
Twenty patients rated a clinic's waiting room on a scale from 1 (very poor) to 5 (very good):
4, 1, 4, 3, 3, 4, 4, 1, 5, 1, 2, 5, 4, 5, 2, 3, 3, 2, 4, 4
Find (a) the frequency of the rating 4, (b) the relative frequency of the rating 4 as a percentage, and (c) the cumulative percentage of ratings at most 3.
Exercise 2 · Practice, difficulty 1 of 3
Reading a cumulative share
An HR team recorded how many days of sick leave each employee in a department took last quarter:
| Days of sick leave | Employees |
|---|---|
| 0 | 12 |
| 1 | 12 |
| 2 | 13 |
| 3 | 4 |
| 4 | 4 |
| 5 | 2 |
What percentage of the employees took at most 2 days of sick leave? Give the percentage to 1 decimal place.
Exercise 3 · Application, difficulty 2 of 3
Mobile wallet share
In the transactions dataset, the payment method is missing for some baskets. Among the transactions whose payment method was recorded, what percentage were paid by mobile_wallet? Give the percentage to 2 decimal places.
Data: transactions · Open in the lab to explore and calculate.
Exercise 4 · Application, difficulty 2 of 3
Row percentage in a two-way table
Using the commute dataset, cross-tabulate shift by mode. What percentage of morning-shift employees travel by car? Give the percentage to 1 decimal place.
Data: commute · Open in the lab to explore and calculate.
Exercise 5 · Interpretation, difficulty 2 of 3
Which percentage is it?
A clinic cross-tabulates 400 patients by smoking status (rows: smoker, non-smoker) and hypertension (columns: yes, no). The report says: “In the smoker row, the hypertension cell shows 30% (row percentages).” Which statement does this support?
Exercise 6 · Practice, difficulty 1 of 3
When does cumulative frequency make sense?
Sort each variable: is a cumulative frequency (a running total down the table) meaningful for it?
Exercise 7 · Practice, difficulty 1 of 3
Steps to a frequency table
Put the steps for building a frequency table with relative and cumulative frequencies of an ordered variable in the right order.
Exercise 8 · Interpretation, difficulty 2 of 3
Comparing branches fairly
Branch A processed 2 000 baskets last month, 300 of them paid in cash. Branch B processed 600 baskets, 150 of them in cash. A manager concludes that “Branch A has the bigger cash problem.” In two or three sentences, explain how the branches should be compared and what the comparison shows.
What you can now do
- Build a frequency table with relative and cumulative frequencies
- Choose the right denominator, including when values are missing
- Read joint, row and column percentages in a two-way table
- Compare groups of different sizes with relative frequencies