Math & Scientific
Mean, Median and Mode for Grouped Data
Distinguish exact frequency tables from interval groups, estimate the mean with midpoints, and interpret grouped median and modal-class calculations.
Identify what the table preserves
A discrete frequency table gives exact values and their counts, while an interval table gives ranges and the number of observations inside each range. For exact values, repeating each value by its count reconstructs the original numerical list for unweighted summaries. For intervals, the original positions within each class are lost. A calculation based only on midpoints or interpolation therefore needs an explicit approximation. Do not present an interval estimate as though the individual observations had been recovered.
Set up a small equal-width example
Use the intervals [0,10), [10,20) and [20,30) with frequencies 2, 3 and 1. The half-open notation includes the lower boundary and excludes the upper boundary, so a value of 10 belongs in the second class only. The total count is six. The class midpoints are 5, 15 and 25. Confirm that the classes do not overlap, that their frequencies cover the intended observations, and that the endpoint convention is consistent before calculating any summary.
Estimate the mean using midpoint weights
The weighted midpoint sum is 2×5+3×15+1×25=80. Dividing by six gives the grouped mean estimate 13.333333. In the local form, enter 5, 5, 15, 15, 15, 25 to check that arithmetic. Every repeated midpoint stands for an observation assumed to lie at the class centre. The actual mean could differ because the original values need not equal their midpoints. Increasing the number of displayed decimals does not remove this loss of information.
Locate and interpolate within the median class
The cumulative frequencies are 2, 5 and 6, so the halfway position N/2=3 falls in the second class. A common grouped estimate is L+((N/2−C)/f)h, where L is that class's lower boundary, C is the count before it, f is its frequency and h is its width. Here it gives 10+((3−2)/3)×10=13.333333. This assumes a uniform accumulation within the class. The raw midpoint list instead has median 15, showing that its ordinary median is a different calculation.
Describe the modal class before estimating a point
The second interval is the modal class because its frequency, three, is the largest. For adjacent equal-width classes with frequencies two, three and one, the familiar interpolation estimate is 10+((3−2)/((3−2)+(3−1)))×10=13.333333. It uses the rise and fall in adjacent class frequencies as a shape approximation. The actual most repeated raw value cannot be recovered from the table. The local midpoint list reports mode 15; that output identifies the most repeated midpoint, not an observed mode or this interpolated estimate.
Check a second distribution and unequal widths
For [0,10), [10,20), [20,30), [30,40) with frequencies 1, 4, 3, 2, the midpoint sum is 210 and the count is ten, giving mean 21. The cumulative counts 1, 5, 8, 10 place the median estimate at the boundary 20. The equal-width modal interpolation is 10+(3/(3+1))×10=17.5. With unequal class widths, comparing counts alone can misidentify the tallest histogram region; frequency density, count divided by width, must be considered instead.
Use exact frequency expansion only when practical
If a table says the exact value 5 occurs twice and the exact value 15 occurs three times, repeating those values is an exact representation of that discrete data set. For very large frequencies, use a frequency-aware statistical workflow instead of pasting an enormous expanded list. The local form has no weighted-frequency fields and should not receive a two-column table as an alternating sequence of values and counts. That would treat the frequencies themselves as observations and answer the wrong question.
Report the approximation and retain the table
State the class boundaries, endpoint convention, frequencies and method beside each grouped result. Python's median_grouped function supplies an interpolated grouped median from midpoint-coded equal-width data when the interval width is specified; it is distinct from median on the same list. Neither method restores unknown original values. For the first table, report an estimated mean of 13.33, an interpolated median of 13.33 and modal class [10,20), with any interpolated modal point clearly labelled as an estimate.
Calculator for the supported step
The local form accepts raw observations, not interval boundaries or a frequency table. Expanding repeated discrete values reproduces exact raw-data summaries. Expanding interval midpoints checks an approximate grouped mean; its raw median and mode are not automatically the grouped estimates.