Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 37 · Averages and Spread

Averages from Frequency Tables

Find the mean, median and mode from a frequency table, then estimate them from grouped data using midpoints, modal class and median class interpolation.

Real data often arrive already counted. Instead of 200 raw numbers you get a table. You can still find every average without going back to the raw values. This lesson shows the shortcuts for ungrouped and grouped tables.

Ungrouped frequency tables

Number of siblings reported by 12 students:

Siblings x Frequency f f × x
0 2 0
1 5 5
2 3 6
3 1 3
4 1 4
Total 12 18
  • Mean = Σfx / Σf = 18 / 12 = 1.5. (The symbol Σ means "sum of".)
  • Mode = the value with the highest frequency: 1 sibling.
  • Median: with 12 values, the median is the mean of the 6th and 7th values. Count the cumulative frequency: values 1 and 2 are 0; values 3 to 7 are 1; so the 6th and 7th are both 1, and the median is 1.
Python Averages from a frequency table

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A common mistake is to find the mean of the frequencies (12 / 5) or of the values ((0+1+2+3+4)/5). Both ignore how often each value occurs.

Grouped frequency tables

When data are grouped in class intervals, you no longer know the exact values, so every answer is an estimate. To estimate the mean, pretend every value in a class sits at the class midpoint.

Heights of 30 students:

Height h (cm) Frequency f Midpoint x f × x
140 ≤ h < 150 3 145 435
150 ≤ h < 160 9 155 1395
160 ≤ h < 170 10 165 1650
170 ≤ h < 180 7 175 1225
180 ≤ h < 190 1 185 185
Total 30 4890

Estimated mean = 4890 / 30 = 163 cm.

For grouped data you cannot give a single mode, but you can name the modal class, the class with the highest frequency (here 160 ≤ h < 170). If class widths differ, the modal class is the one with the highest frequency density.

Estimating the median

The median is the value of the (n/2)-th observation. Here n/2 = 15. The cumulative frequencies are 3, 12, 22, 29, 30. The 15th value falls in the class 160 to 170, the median class. Assuming values are spread evenly inside that class, interpolate:

median ≈ lower boundary + ((n/2 − cumulative frequency before the class) / class frequency) × class width

median ≈ 160 + ((15 − 12) / 10) × 10 = 163 cm.

Python Estimate mean and median from grouped data

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A grouped mean is an estimate. The true mean of the raw data can differ, because values within a class are not all at the midpoint. Always say "estimate".

Combined means (weighted means)

If you know the means of two groups, you cannot average the means unless the groups are the same size. Use the totals instead.

Example: 20 students have a mean score of 70 and 30 students have a mean of 80. The overall mean is (20×70 + 30×80) / 50 = (1400 + 2400) / 50 = 76, not 75.

Python Weighted mean of two groups

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. A table shows x = 1, 2, 3 with frequencies 4, 3, 3. What is the mean?

    Σfx = 4×1 + 3×2 + 3×3 = 4 + 6 + 9 = 19, and Σf = 10, so the mean is 19 / 10 = 1.9.
  2. 2. Why is a mean from grouped data only an estimate?

    We assume each value is at its class midpoint, which is usually close but not exact.
  3. 3. For grouped data, the modal class is

    The mode idea is 'most common', applied to classes.
  4. 4. 10 students average 60 and 40 students average 70. The overall mean is

    (10×60 + 40×70) / 50 = 3400 / 50 = 68.

Summary

  • From an ungrouped table, mean = Σfx / Σf; the mode has the highest frequency; the median comes from cumulative frequencies.
  • For grouped data use midpoints for the mean, a modal class and a median class (with interpolation); the answers are estimates.
  • To combine group means, weight by group size.

Next: Range, Quartiles and the Interquartile Range