How to use the grouped data statistics calculator
- Type one class per line as lower boundary, upper boundary, frequency, lowest class first. Classes should follow each other without overlapping.
- Check the estimates for the mean, median and mode, and the quartiles and standard deviations below them.
- Use the cumulative table to see how the count builds up through the classes. The last cumulative value is the total frequency.
- If you still have the raw values, use them instead. Grouping loses detail, so every number here is an estimate.
Formula
mean = sum of (frequency x midpoint) / n
median = L + ((n/2 - F) / f) x width
mode = L + (f1 - f0) / (2 f1 - f0 - f2) x width
variance = sum of frequency x (midpoint - mean)^2 / n (or n - 1)
L is the lower boundary of the class that holds the half-way point (or the modal class), F the count below that class, f its frequency and width its width. f0 and f2 are the frequencies of the classes before and after the modal class. Quartiles use the same interpolation at n/4 and 3n/4.
Five classes of width 10
The default classes are 0 to 10 (4 values), 10 to 20 (11), 20 to 30 (17), 30 to 40 (9) and 40 to 50 (4), so n = 45. The mean is 24.556 and the median falls in the 20 to 30 class: 20 + ((22.5 - 15) / 17) x 10 = 24.412. The modal class is 20 to 30, so the mode is 20 + (17 - 11) / (34 - 11 - 9) x 10 = 24.286.
The lower quartile is 16.591 and the upper quartile 31.944. The sum of frequency times squared distance from the mean divided by 44 gives a sample standard deviation of 10.862, and dividing by 45 gives the population value 10.740.
Why grouped estimates differ from raw results
When values are put into classes, the only thing known about each value is which class it fell in. The mean treats every value in a class as if it sat at the midpoint, and the median and quartiles treat the values in a class as spread evenly. Both are reasonable guesses but not the exact numbers you would get from the raw data.
Narrower classes make the estimates closer. If your classes are uneven in width, the median and quartile formulas still work because they use the width of the class they land in. The mode formula assumes the neighbors are comparable, so read it as a rough guide.
Boundaries and gaps
Enter true class boundaries, for example 10 and 20, rather than whole-number limits such as 10 to 19 and 20 to 29. If your table shows 10 to 19, use 9.5 to 19.5 so that the classes meet. To build the table from raw numbers first, use the Frequency Distribution Calculator, and to see it as a chart, the Histogram Maker.
More statistics tools
To describe a distribution or compare groups, try the Skewness and Kurtosis Calculator, Kaplan-Meier Estimator and Coupon Collector Calculator.
Assumptions and limits
- Frequencies are whole counts of 0 or more, and the classes are continuous intervals that do not overlap.
- Values inside a class are treated as evenly spread, with the midpoint as the representative value in the mean formula.
- Gaps between classes are allowed but are treated as if they held no values.
- No correction such as Sheppard's correction is applied to the variance.
Frequently asked questions
Why does my textbook give a slightly different mode?
Some books use the midpoint of the modal class instead of the interpolation formula. This page uses the interpolation formula with the frequencies on both sides of the modal class.
What if two classes have the same highest frequency?
The first of them is used for the mode and a note says so. A table with two peaks has no single mode, so the estimate is only one of several reasonable answers.
Which standard deviation should I use?
Use the sample value when the data are a sample of a larger group and the population value when the classes cover every item in the group you care about.
Can I enter open-ended classes such as "50 and over"?
No. Every class needs a lower and an upper boundary. For an open class, choose a reasonable upper limit yourself and keep in mind that it changes the mean and the spread.