Variance for grouped data
For frequency data (xi,fi) with N=∑fi:
σ2=N1∑fi(xi−xˉ)2=N∑fixi2−xˉ2.
For grouped data, take xi as the midpoint of each class.
When the xi are large or awkward, two tricks reduce the arithmetic.
Short-cut method
Pick a convenient origin (assumed mean) a. Let di=xi−a. Then
σ2=N∑fidi2−(N∑fidi)2.
Reason: variance is shift-invariant; subtracting a from every xi leaves σ2 unchanged.
The mean is xˉ=a+N∑fidi.
Step-deviation method
When the class widths are equal to some h, define ui=(xi−a)/h. Then
σ2=h2[N∑fiui2−(N∑fiui)2].
This makes the ui small integers, which keeps the arithmetic clean. The mean is
xˉ=a+h⋅N∑fiui.
Step-by-step procedure
- Tabulate classes, find midpoints xi.
- Choose assumed mean a (often a central midpoint).
- Compute ui=(xi−a)/h.
- Compute fiui and fiui2.
- Apply formulas above.
Worked examples
Example 1. Find variance and SD for:
| Class | 0–10 | 10–20 | 20–30 | 30–40 | 40–50 |
|---|
| fi | 5 | 8 | 15 | 7 | 5 |
Midpoints xi: 5,15,25,35,45. N=40.
Use a=25,h=10.
ui: −2,−1,0,1,2. fu: −10,−8,0,7,10. fu2: 20,8,0,7,20.
∑fu=−1. ∑fu2=55.
σ2=h2[55/40−(−1/40)2]=100[1.375−0.000625]=100⋅1.374375=137.4375.
σ=137.4375≈11.72.
Mean: xˉ=25+10⋅(−1/40)=25−0.25=24.75.
Example 2. Find variance for:
| x | 10 | 20 | 30 | 40 | 50 |
|---|
| f | 4 | 8 | 10 | 5 | 3 |
N=30. ∑fx=40+160+300+200+150=850. xˉ=850/30≈28.33.
∑fx2=400+3200+9000+8000+7500=28100.
σ2=28100/30−(28.33)2≈936.67−802.56≈134.11.
σ≈11.58.
Example 3. Compute SD for the data with the same midpoints as Example 1 above using direct formula (no shortcut).
We already found xˉ=24.75. Squared deviations (xi−xˉ)2: (5−24.75)2=390.06, (15−24.75)2=95.06, (25−24.75)2=0.06, (35−24.75)2=105.06, (45−24.75)2=410.06.
Multiply by fi: 1950.31,760.50,0.94,735.44,2050.31. Sum: 5497.5. σ2=5497.5/40=137.44. (Matches example 1.)
Example 4. Find variance of:
| Marks | 0–10 | 10–20 | 20–30 | 30–40 | 40–50 | 50–60 |
|---|
| fi | 5 | 9 | 17 | 29 | 10 | 6 |
Midpoints: 5,15,25,35,45,55. N=76. a=35,h=10, ui: −3,−2,−1,0,1,2.
fu: −15,−18,−17,0,10,12. Sum: −28.
fu2: 45,36,17,0,10,24. Sum: 132.
σ2=100[132/76−(−28/76)2]=100[1.7368−0.1356]=160.13.
σ≈12.65.
Mean: 35+10⋅(−28/76)=35−3.68=31.32.
Example 5. Without computing, what happens to the SD if every observation is multiplied by 5?
σy=∣5∣σx=5σx.
Try it yourself
-
Find variance and SD of:
| x | 2 | 4 | 6 | 8 | 10 |
|---|---|---|---|---|---|
| f | 3 | 5 | 7 | 4 | 1 |
-
Find SD of:
| Class | 0–5 | 5–10 | 10–15 | 15–20 |
|---|---|---|---|---|
| f | 4 | 6 | 5 | 3 |
-
Compute mean and SD using step-deviation method for:
| Class | 20–30 | 30–40 | 40–50 | 50–60 | 60–70 |
|---|---|---|---|---|---|
| f | 5 | 8 | 10 | 4 | 3 |
-
The mean and SD of 20 observations are 10 and 2. Each observation is multiplied by 3. Find the new mean and SD.
-
If the SD of xi is σ and each xi is replaced by a+bxi, what is the new SD?
-
Mean of 50 observations is 40 and SD is 6. Find ∑xi and ∑xi2.
-
SD of the first 100 natural numbers (Use σ=(n2−1)/12).
-
The variance of 5 numbers a,b,c,d,e is 9. Find the variance of a+2,b+2,c+2,d+2,e+2.
-
Find variance of xi: −2,−1,0,1,2.
-
The mean of 5 observations is 4.4 and variance 8.24. If 3 of them are 1,2,6, find the other two.
-
SD of 20 observations is 5. If three new observations 0,4,7 are added, find new SD.
-
If ∑(xi−5)=30, ∑(xi−5)2=230, n=10, find xˉ and σ.
Pitfalls / Tricks
- Always use midpoints for grouped data.
- Step-deviation: ui should be small integers.
- Remember σy=∣b∣σx when y=a+bx , shift contributes nothing.
- Insight. Variance is a quadratic statistic , it cares about squared deviations. This both amplifies outliers and makes it mathematically tractable.