1. Two decisions before you calculate
A grouped table records how many observations fall in each interval. For a bounded class [a,b), use its midpoint as a stand-in for each of its observations. The midpoint is equally far from either boundary, so it minimizes the largest possible absolute error when replacing one value in the class. It need not be the actual within-class mean. Do not give each class one vote: a class with 12 observations contributes 12 times. With unequal widths, use counts, not histogram heights; for frequency-density bars, count equals height times width.
Let denote the total count and use . First compute the midpoint-coded mean , then the weighted sum of squared deviations . The mean always divides by . Only the final variance denominator depends on the goal.
Use to describe the spread of the recorded list using the midpoint-coded approximation, including when they constitute the entire population of interest. Use for the conventional sample variance of the midpoint-coded values when . With raw independent, identically distributed observations of finite variance, the latter convention gives an unbiased estimator of the population variance. With a fixed coding rule, the coded observations are also independent and identically distributed, but unbiasedness concerns the coded variable’s variance, not the original variable’s variance. It does not recover lost data or make the standard deviation unbiased. Follow the stated convention when a problem specifies one.
2. Worked example: same numerator, two goals
Eight waiting times, in minutes, fall into with counts . The midpoints are . The weighted mean is minutes. The weighted squared-deviation sum is .
To describe these eight recorded waits, use minutes squared. If instead asked for the corrected sample variance from the grouped table, use minutes squared. The corresponding standard deviations are and minutes. Both calculations use the same midpoint replacement; neither claims to recover the true raw-data spread.
3. Worked example: why one is subtracted
Take two independent draws from a population that returns 0 or 1 with equal probability. The population mean is and variance is . The equally likely samples are . Around each sample’s own mean the squared-deviation sums are . Their average is .
Dividing each sum by gives an average of , too small; dividing by gives , the target. The adjustment works on average over samples, not sample by sample. In general, centring at the fitted sample mean instead of the true mean reduces the squared-deviation sum by . The fitted deviations also sum to zero: once are known, the last is fixed.
4. Worked example: same bins, different spread
The classes each have two observations. The midpoint-coded list is , with mean 10 and descriptive variance . Actual values could be or . Both lists have mean 10 and the same class counts, but their descriptive variances are and .
The midpoint variance is above one raw variance and below the other. Replacing observations by class centres can shift between-class distances as well as erase within-class spread. Changing the denominator cannot resolve either ambiguity. If a nonempty class is unbounded, it has no finite midpoint and this procedure needs additional information or a model.
5. Six practice exercises
1. Weight the centres
The classes have counts . Find the midpoint-coded mean.
Hint
Count observations, not classes.
Explained solution
The centres are . The coded mean is , not the unweighted mean of the three centres.
2. Describe the recorded list
Using Exercise 1, find the descriptive midpoint variance and standard deviation.
Hint
Use the mean you just found, and divide by the total count.
Explained solution
. The variance is squared units. The standard deviation is original units.
3. Change the goal, not the mean
For the table in Exercise 1, the problem now asks for corrected sample variance. What changes?
Hint
Keep the numerator and the weights.
Explained solution
Only the denominator changes. The answer is squared units. It is still computed on the midpoint-coded values.
4. Convert density to count
Bins have frequency-density heights observations per unit. Find the descriptive midpoint variance.
Hint
Both bars have the same area.
Explained solution
Counts are and . The centres give mean 3. The variance is squared units.
5. Zero in the table, nonzero underneath
One class contains three observations. Can the raw descriptive variance be positive when the midpoint-coded variance is zero?
Hint
Try three different values within the class.
Explained solution
Yes. The coded list gives zero. The raw list fits the same class, has mean 5 and descriptive variance . The corrected coded sample variance is also zero; switching denominators does not help.
6. Check what is defined
One observation belongs to . Find the coded descriptive variance and decide whether a corrected sample variance exists. What if the only observation instead belongs to ?
Hint
Separate the single-value case from the missing-centre case.
Explained solution
For the bounded class the coded value is 15 and descriptive variance is zero. The corrected sample variance is undefined because . For the unbounded class, no finite midpoint can be computed, although the descriptive variance of any single finite raw value is still zero.
6. Final check
Check the class centres, counts, mean, squared deviations, and only then the denominator. State the units and say what the grouping hides. See OpenStax: Measures of the Spread of the Data for the midpoint method and variance conventions, Penn State STAT 500 for the variance correction, or continue with grouped-data quantiles.
Useful for
Work on the step you’re missing.
Tell us the subject and your preferred time. Nablio confirms the details by text or email.
Request a lesson