Why Unequal Group Sizes Change the Calculation
In a one-way analysis of variance, groups may contain different numbers of observations. The grand mean must represent all observations, so a group with more observations contributes more to it than a smaller group does. The same weighting appears in the between-group sum of squares: each group mean’s squared distance from the grand mean is multiplied by that group’s size.
This is a calculation about observed group summaries. For the usual one-way fixed-effects ANOVA inference, the observations are assumed independent, normally distributed within each group, and to have a common variance. Those assumptions concern the validity of the inferential procedure; they are not required simply to calculate the grand mean or the between-group sum of squares from given data.
The factor \(n_i\) is essential. The group mean summarizes the observations in its group, but it does not replace the observations when calculating the overall mean. Each observed value has equal weight in the grand mean; consequently, a group mean is weighted according to how many values it summarizes.
Grand Mean and Between-Group Sum of Squares
If group \(i\) has sample total \(T_i\), then \(\bar{x}_{i\cdot}=T_i/n_i\). Adding all group totals and dividing by the total number of observations gives
Thus, the grand mean is a weighted average of the group means, with weights equal to group sizes. Once it is calculated, the between-group sum of squares is the weighted sum of squared deviations of the group means from that grand mean. It is measured in squared units of the original observations.
Why the Group Sizes Are the Weights
The weighted grand mean follows directly from the definition of an average. Each group’s total is \(n_i\bar{x}_{i\cdot}\), so the total of all observations is \(\sum_i n_i\bar{x}_{i\cdot}\). Dividing this total by \(N\) gives the grand mean. The same group size appears in \(SS_{\text{between}}\) because the group’s squared deviation is counted once for each observation represented by that group mean.
The algebra also verifies the equivalent formula. For an observation \(x_{ij}\) in group \(i\), write its deviation from the grand mean as \((x_{ij}-\bar{x}_{i\cdot})+(\bar{x}_{i\cdot}-\bar{x}_{\cdot\cdot})\). Squaring and summing over observations produces a cross term. Within each group, \(\sum_j(x_{ij}-\bar{x}_{i\cdot})=0\), so that cross term vanishes. The remaining group-mean part is exactly \(SS_{\text{between}}\). Expanding that part gives the equivalent formula:
In the second equality, \(\sum_i n_i\bar{x}_{i\cdot}=N\bar{x}_{\cdot\cdot}\) and \(\sum_i n_i=N\). This also explains why using an unweighted average of group means can lead to an incorrect result: it generally does not equal the mean of all observations when the group sizes differ.
Worked Example: Calculate From the Raw Observations
A hypothetical service study records processing times, in minutes, for three independent teams. Team A records \(2,6,7\); Team B records \(8,10,12,14\); and Team C records \(15,17\). Find each group mean, the grand mean, and \(SS_{\text{between}}\). Use the weighted-deviation formula, then check with the equivalent formula.
Method. First calculate each group size and mean. The sizes are \(n_1=3\), \(n_2=4\), and \(n_3=2\), so \(N=3+4+2=9\).
Team A has total \(2+6+7=15\), giving \(\bar{x}_{1\cdot}=15/3=5\). Team B has total \(8+10+12+14=44\), giving \(\bar{x}_{2\cdot}=44/4=11\). Team C has total \(15+17=32\), giving \(\bar{x}_{3\cdot}=32/2=16\).
The overall total is \(15+44+32=91\). Therefore, \(\bar{x}_{\cdot\cdot}=91/9=10.1111\ldots\). Keep the exact value \(91/9\) during the calculation.
The group deviations from the grand mean are \(5-91/9=-46/9\), \(11-91/9=8/9\), and \(16-91/9=53/9\). Thus,
Check. The weighted sum of squared group means is \(3(5^2)+4(11^2)+2(16^2)=75+484+512=1071\). Also, \(N\bar{x}_{\cdot\cdot}^{\,2}=9(91/9)^2=8281/9\). The difference is \(1071-8281/9=(9639-8281)/9=1358/9\), agreeing with the direct calculation. This method avoids treating the three groups as if they had equal sizes.
How Sample Size Affects Each Contribution
For a fixed grand mean and group mean, the group’s term is \(n_i(\bar{x}_{i\cdot}-\bar{x}_{\cdot\cdot})^2\). A larger group therefore contributes more than a smaller group with the same distance from the grand mean. A group close to the grand mean can still make a modest contribution even if it is large, while a smaller group far from the grand mean can also contribute substantially. The term depends on both the size and the squared distance.
Worked Example: Use Group Summaries With Unequal Sizes
A hypothetical quality review reports three group summaries for a measured delay, in seconds: Group A has \(n_1=2\) and mean \(4\); Group B has \(n_2=5\) and mean \(7\); Group C has \(n_3=3\) and mean \(10\). Calculate the grand mean and between-group sum of squares. Then identify each group’s contribution.
Method. Weight each mean by its group size. The total sample size is \(N=2+5+3=10\), and the weighted sum of group means is \(2(4)+5(7)+3(10)=8+35+30=73\). Hence \(\bar{x}_{\cdot\cdot}=73/10=7.3\) seconds.
Group A’s contribution is \(2(4-7.3)^2=2(-3.3)^2=2(10.89)=21.78\). Group B’s contribution is \(5(7-7.3)^2=5(-0.3)^2=5(0.09)=0.45\). Group C’s contribution is \(3(10-7.3)^2=3(2.7)^2=3(7.29)=21.87\).
Adding the terms gives \(SS_{\text{between}}=21.78+0.45+21.87=44.10\text{ seconds}^2\).
Check. The weighted sum of squared means is \(2(4^2)+5(7^2)+3(10^2)=32+245+300=577\). The grand-mean term is \(10(7.3^2)=10(53.29)=532.9\), so \(577-532.9=44.1\), as before. Notice that Group B’s mean is closest to the grand mean, and its contribution is the smallest.
When an Unweighted Average Happens to Agree
An unweighted average of group means gives every group equal influence, regardless of how many observations it contains. If all group sizes are equal, this average and the observation-weighted grand mean agree for any group means. With unequal group sizes, they do not generally agree—but they can agree for particular group means. Equal group sizes guarantee agreement; unequal sizes do not rule it out.
Worked Example: Unequal Sizes With Coinciding Averages
A hypothetical pilot records values for three groups. Group A contains \(4\); Group B contains \(7,11\); and Group C contains \(2,4,6\). Find the group means, compare the unweighted and weighted averages, and calculate \(SS_{\text{between}}\).
Method. The group sizes are \(1,2,3\). The means are \(4/1=4\), \((7+11)/2=9\), and \((2+4+6)/3=4\). The unweighted average of the three group means is \((4+9+4)/3=17/3\).
The observation-weighted grand mean is \((1(4)+2(9)+3(4))/(1+2+3)=(4+18+12)/6=34/6=17/3\). The two averages happen to agree, even though the group sizes differ.
The deviations from the grand mean are \(4-17/3=-5/3\), \(9-17/3=10/3\), and \(4-17/3=-5/3\). Therefore,
Check. The weighted sum of squared means is \(1(4^2)+2(9^2)+3(4^2)=16+162+48=226\). Also, \(N\bar{x}_{\cdot\cdot}^{\,2}=6(17/3)^2=578/3\). Thus \(226-578/3=(678-578)/3=100/3\), matching the direct result. This coincidence is specific to these means; it does not make unweighted averaging a generally valid method for unequal group sizes.
Common Exam Trap: Give Every Group Equal Weight
Return to the summaries in the second worked example. An incorrect calculation averages the three group means without using their sample sizes: \(\bar{x}_{\cdot\cdot,\text{wrong}}=(4+7+10)/3=7\). It then uses that incorrect center to obtain \(2(4-7)^2+5(7-7)^2+3(10-7)^2=18+0+27=45\).
The correction is to use the observation-weighted mean, \(7.3\), which gives \(2(4-7.3)^2+5(7-7.3)^2+3(10-7.3)^2=44.1\). The erroneous center also fails a direct check: the observations represented by the summaries have total \(73\), and \(73/10=7.3\), not \(7\).
Keep exact fractions or enough decimal places during intermediate calculations. If group means or the grand mean are rounded early, the final sum of squares can differ slightly from the value obtained from the unrounded summaries.
Check Your Understanding
For each problem, calculate the requested quantities using the group sizes as weights.
- Two groups have sizes \(2\) and \(3\), with means \(6\) and \(10\). Find the grand mean and \(SS_{\text{between}}\). (Answer: grand mean \(8.4\); \(SS_{\text{between}}=19.2\))
- Three groups have sizes \(2,4,1\) and means \(3,5,11\), respectively. Find the grand mean and between-group sum of squares. (Answer: grand mean \(37/7\); \(SS_{\text{between}}=304/7\approx43.4286\))
- Three groups report observations A: \(3,5\); B: \(6,8,10\); and C: \(10,14\). Find the three group means, the grand mean, and \(SS_{\text{between}}\). (Answer: means \(4,8,12\); grand mean \(8\); \(SS_{\text{between}}=64\))
- Groups of sizes \(1,3,2\) have means \(2,5,8\). Calculate the weighted grand mean and \(SS_{\text{between}}\), and compare the grand mean with the unweighted mean of the group means. (Answer: weighted grand mean \(5.5\); unweighted mean \(5\); \(SS_{\text{between}}=25.5\))
- Two groups have sizes \(2\) and \(3\), and means \(4\) and an unknown value \(m\). Their combined grand mean is \(6\). Find \(m\) and \(SS_{\text{between}}\). (Answer: \(m=34/3\); \(SS_{\text{between}}=40/3\))