Combined mean and combined variance · Mathematics Class… | StemPy Lab
Course 17.2·Lesson 2 of 3
Combined mean and combined variance
Two classes have been marked separately and each class has its own mean and standard deviation. The combined mean is a weighted mean. The combined variance needs the spread inside each group and also the distance of each group mean from the combined mean. The same method corrects a wrong reading.
about 25 min1 simulation1 practice question
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
find the mean of two or more groups taken together;
find the combined variance and standard deviation from the group means and standard deviations;
correct a data set when one reading was wrong, without going back to every value.
The head teacher's question
A head teacher has the results of two classes. Class A has 30 students, with mean 60 and standard deviation 8. Class B has 20 students, with mean 70 and standard deviation 6. She wants the mean and the standard deviation of all 50 students. The marks are not in front of her. Only the three numbers for each class are. Can she still find the answer?
The combined mean
The total marks of a group is its size times its mean. So the total for both groups is n1xˉ1+n2xˉ2, and there are n1+n2 students. The combined mean is
xˉ=n1+n2n1xˉ1+n2xˉ2.
It is a weighted mean: each group mean counts as many times as its group has members. Here xˉ=5030×60+20×70=503200=64. Notice that 64 is not the middle of 60 and 70, because the larger group pulls it nearer to 60.
You cannot average the standard deviations
It is tempting to find the combined standard deviation as 28+6=7, or as a weighted mean of 8 and 6. Both are wrong. Think of two groups where every value is the same, so each has standard deviation 0. If the two values differ, say all the values in one group are 10 and in the other 20, the combined data are certainly spread out. So the spread of the whole depends on how far apart the group means are, as well as on the spread inside each group.
The combined variance
In the last course we met the identity: for any centre a, the mean square deviation about a equals σ2+(xˉ−a)2. Apply it to group i with the centre a=xˉ, the combined mean. The sum of the squared distances of group i from xˉ is then ni(σi2+di2), where di=xˉi−xˉ. Add the two groups and divide by n1+n2:
σ2=n1+n2n1(σ12+d12)+n2(σ22+d22).
Read it in words: the combined variance is the weighted mean of the spread inside each group (σi2) and the spread of the group means (di2).
Smooth bell-shaped curves of marks from 20 to 110, showing the number of students per mark. A blue curve for group A, 30 students, peaks at 60 and is the wider of the two groups. An orange curve for group B, 20 students, peaks at 70 and is narrower. A thick green curve, the two groups together, is the sum of the two and peaks near 66. A vertical dashed green line at 64 marks the combined mean, and the legend gives the combined standard deviation 8.76.
For the two classes, d1=60−64=−4 and d2=70−64=6. Then
The combined standard deviation is a little larger than both 8 and 6, because the means 60 and 70 are apart.
For samples, A-Level and IB courses combine groups in the same spirit, but with the sums of squares and the divisor n−1. The formula above is for data that are the whole group, which is how the Indian syllabus states it.
Correcting a reading
A reading was copied wrongly. We keep the two totals, ∑x and ∑x2, and then replace the bad value by the good one.
For 10 values with mean 20 and standard deviation 4, a reading of 12 should have been 22.
The old totals.∑x=10×20=200. ∑x2=10(16+400)=4160.
The corrected totals.∑x=200−12+22=210. ∑x2=4160−144+484=4500.
The new mean.10210=21.
The new variance.104500−212=450−441=9, so the standard deviation is 3.
The same steps handle a value that is added or removed.
Practise with new numbers
Try it in Python
The program combines the two classes of the lesson. It finds the combined mean, the two distances d1 and d2, and the combined variance.
Common mistakes
Averaging the means without weights. Weight each mean by the size of its group.
Averaging the standard deviations. Use the combined variance formula.
Forgetting di2. The distance of each group mean from the combined mean matters.
Dividing by n1 or n2. Divide by n1+n2.
Correcting only the mean. A wrong reading changes ∑x2 too.
Remember these
xˉ=n1+n2n1xˉ1+n2xˉ2.
σ2=n1+n2n1(σ12+d12)+n2(σ22+d22), with di=xˉi−xˉ.
When the two means are equal, d1=d2=0 and the combined variance is the weighted mean of the two variances.
To correct a reading, change ∑x and ∑x2, then find the mean and the variance again.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
A group of 15 boys has mean height 150cm and a group of 25 girls has mean height 142cm. Find the mean height of all 40.
Two groups both have mean 50 and standard deviation 6. What are the mean and the standard deviation of the two groups together?
In one group of 10 values every value is 10. In another group of 10 values every value is 20. Find the mean and the standard deviation of all 20 values.
The mean of 8 readings is 15. One reading, written as 12, should have been 20. Find the correct mean.
Group A has 40 values with variance 25. Group B has 60 values with variance 16. Both groups have mean 50. Find the combined variance.
References
OpenStax, Introductory Statistics, Chapter 2, section on the mean and the spread.
NCERT, Mathematics for Class XI, Chapter 13 (Statistics), exercises on the combined mean and the corrected standard deviation.
Enroll free in Comparing and Combining Data
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.