Mean, median and mode of grouped data

MathematicsStatisticsAges 16–17

Use with my class

Generate a sample of test scores out of 100 and group them into a frequency chart. Change the class width or the distribution shape, and click a bar to see its frequency and cumulative frequency; the simulation computes the mean, median and mode using the grouped-data formulas and compares them with the values from the raw data.

Lesson: Mean, median and mode of grouped data

What it shows

When data are only available as a grouped frequency table, the mean, median and mode have to be estimated. The mean uses class midpoints, x̄ = Σfᵢcᵢ/n; the median is found by interpolating inside the class where the cumulative frequency passes n/2; the mode is estimated inside the class with the highest frequency, using the frequencies of the classes on either side. The simulation groups a sample of test scores out of 100 and shows the grouped mean and median next to the values from the raw scores, so students see the error that grouping introduces and how skew pulls the mean away from the median.

How to use

Choose the Shape of the sample distribution and the Sample size n, then click bars to read each class's frequency and cumulative frequency and locate the median class by hand before checking the panel. Compare the grouped estimates with the raw-data values, then change Class width h between 5 and 25 points and watch how the difference changes. Click New sample to test whether a pattern holds for other samples; Show raw data marks the individual scores.

Parameters you can change

  • Sample size n 20–500
  • Class width h 5–25 points
  • Shape of the sample distribution Symmetric (bell-shaped), Right-skewed (tail on the right), Left-skewed (tail on the left), Roughly uniform
  • Sample seed (change for a different sample) 1–99

Questions to explore

  1. How can the cumulative frequency column be used to find the class that contains the median?
  2. For which distribution shape are the mean, median and mode closest together, and why?
  3. How does increasing the class width h affect the difference between the grouped mean and the raw-data mean?