Independent study guide

Grouped-Data Variance: Midpoints, n or n−1?

Estimate variance and standard deviation from class counts. Three worked examples and six exercises show when to divide by n or n−1 and what grouping hides.

Nablio · 6 questionsPublished

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 m=(a+b)/2m=(a+b)/2 as a stand-in for each of its ff 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 n=∑jfjn=\sum_j f_j denote the total count and use n>0n>0. First compute the midpoint-coded mean mˉ=∑jfjmj/n\bar m=\sum_j f_jm_j/n, then the weighted sum of squared deviations T=∑jfj(mj−mˉ)2T=\sum_j f_j(m_j-\bar m)^2. The mean always divides by nn. Only the final variance denominator depends on the goal.

Use T/nT/n to describe the spread of the recorded list using the midpoint-coded approximation, including when they constitute the entire population of interest. Use T/(n−1)T/(n-1) for the conventional sample variance of the midpoint-coded values when n>1n>1. 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 [0,4),[4,8),[8,12)[0,4),[4,8),[8,12) with counts 2,4,22,4,2. The midpoints are 2,6,102,6,10. The weighted mean is mˉ=(2(2)+4(6)+2(10))/8=6\bar m=(2(2)+4(6)+2(10))/8=6 minutes. The weighted squared-deviation sum is T=2(2−6)2+4(6−6)2+2(10−6)2=64T=2(2-6)^2+4(6-6)^2+2(10-6)^2=64.

To describe these eight recorded waits, use 64/8=864/8=8 minutes squared. If instead asked for the corrected sample variance from the grouped table, use 64/7≈9.1464/7\approx9.14 minutes squared. The corresponding standard deviations are 8≈2.83\sqrt{8}\approx2.83 and 64/7≈3.02\sqrt{64/7}\approx3.02 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 1/21/2 and variance is 1/41/4. The equally likely samples are (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1). Around each sample’s own mean the squared-deviation sums are 0,1/2,1/2,00,1/2,1/2,0. Their average is 1/41/4.

Dividing each sum by n=2n=2 gives an average of 1/81/8, too small; dividing by n−1=1n-1=1 gives 1/41/4, 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 n(xˉ−μ)2n(\bar x-\mu)^2. The fitted deviations also sum to zero: once n−1n-1 are known, the last is fixed.

4. Worked example: same bins, different spread

The classes [0,10),[10,20)[0,10),[10,20) each have two observations. The midpoint-coded list is 5,5,15,155,5,15,15, with mean 10 and descriptive variance 2525. Actual values could be 8,9,11,128,9,11,12 or 1,2,18,191,2,18,19. Both lists have mean 10 and the same class counts, but their descriptive variances are (4+1+1+4)/4=2.5(4+1+1+4)/4=2.5 and (81+64+64+81)/4=72.5(81+64+64+81)/4=72.5.

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 [0,2),[2,6),[6,10)[0,2),[2,6),[6,10) have counts 1,2,11,2,1. Find the midpoint-coded mean.

Hint

Count observations, not classes.

Explained solution

The centres are 1,4,81,4,8. The coded mean is (1+2(4)+8)/4=4.25(1+2(4)+8)/4=4.25, 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

T=(1−4.25)2+2(4−4.25)2+(8−4.25)2=24.75T=(1-4.25)^2+2(4-4.25)^2+(8-4.25)^2=24.75. The variance is 24.75/4=6.187524.75/4=6.1875 squared units. The standard deviation is 6.1875≈2.487\sqrt{6.1875}\approx2.487 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 24.75/(4−1)=8.2524.75/(4-1)=8.25 squared units. It is still computed on the midpoint-coded values.

4. Convert density to count

Bins [0,2),[2,8)[0,2),[2,8) have frequency-density heights 3,13,1 observations per unit. Find the descriptive midpoint variance.

Hint

Both bars have the same area.

Explained solution

Counts are 2(3)=62(3)=6 and 6(1)=66(1)=6. The centres 1,51,5 give mean 3. The variance is (6(1−3)2+6(5−3)2)/12=4(6(1-3)^2+6(5-3)^2)/12=4 squared units.

5. Zero in the table, nonzero underneath

One class [0,10)[0,10) 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 5,5,55,5,5 gives zero. The raw list 1,5,91,5,9 fits the same class, has mean 5 and descriptive variance 32/3>032/3>0. The corrected coded sample variance is also zero; switching denominators does not help.

6. Check what is defined

One observation belongs to [10,20)[10,20). Find the coded descriptive variance and decide whether a corrected sample variance exists. What if the only observation instead belongs to [20,∞)[20,\infty)?

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 n−1=0n-1=0. 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