Tutorials › Introduction to Statistics › Weighted Grand Means for Unequal Groups

One-Way ANOVA · Tutorial 849 of 996

Weighted Grand Means for Unequal Groups

Use group sample sizes as weights to calculate the overall mean correctly when groups contain different numbers of observations.

Intermediate 9 min read

What You'll Learn

  • Define the grand mean for observations divided into groups
  • Calculate the grand mean from group means and group sample sizes
  • Explain why larger groups contribute more to the overall mean
  • Distinguish the weighted grand mean from the unweighted average of group means
  • Verify a weighted calculation using group totals or raw observations

Why Group Size Matters

When observations are organized into groups, each group has a sample mean. To find the mean of all observations combined, those group means must contribute according to how many observations they summarize. A group containing 40 measurements represents more of the full data set than a group containing 5 measurements, so its mean should have more influence on the overall mean.

This distinction is important in one-way ANOVA, where the groups may have unequal sample sizes. The grand mean is the mean of every observation pooled across all groups. It is not generally the ordinary average of the group means. The correct calculation is a weighted average, with each group mean weighted by its sample size.

Definition: Suppose a quantitative response is measured in \(k\) groups. Let \(n_j\) be the sample size in group \(j\), let \(\bar{x}_j\) be that group’s sample mean, and let \(N=\sum_{j=1}^{k}n_j\) be the total sample size. The grand mean, written \(\bar{x}\), is the mean of all \(N\) observations pooled together: $$ \bar{x}=\frac{\sum_{j=1}^{k} n_j\bar{x}_j}{N} =\frac{\sum_{j=1}^{k} n_j\bar{x}_j}{\sum_{j=1}^{k}n_j}. $$

The weights are the group sample sizes \(n_j\). Each group mean is multiplied by the number of observations it represents, the products are added, and the result is divided by the total number of observations. Because the weights add to \(N\), the formula is a weighted average.

This identity is an arithmetic fact about the observed data. It does not require equal group sizes, equal variances, or a particular probability model. It does require that the group means summarize the observations being combined, that the groups do not overlap, and that all measurements use the same variable and units.

Deriving the Weighted Formula

The formula follows directly from what a sample mean represents. In group \(j\), the mean is the group total divided by the group size. Multiplying the mean by its group size recovers the sum of that group’s observations. Adding these group totals gives the total of all observations, and dividing by the total sample size gives the pooled mean.

$$ \bar{x}_j=\frac{\text{sum of observations in group }j}{n_j} \quad\Longrightarrow\quad \text{sum of observations in group }j=n_j\bar{x}_j. $$

If the group \(j\) observations are \(x_{1j},x_{2j},\ldots,x_{n_jj}\), then \(n_j\bar{x}_j=\sum_{i=1}^{n_j}x_{ij}\). Summing across groups and dividing by \(N\) gives

$$ \bar{x} =\frac{\sum_{j=1}^{k}\sum_{i=1}^{n_j}x_{ij}}{N} =\frac{\sum_{j=1}^{k}n_j\bar{x}_j}{N}. $$

Thus, the weighted formula is not a special adjustment or an approximation. It is exactly the ordinary sample mean, rewritten using group summaries instead of listing every observation. If the raw observations are available, pooling them and calculating their mean must give the same result.

Worked Example: Two Unequal Groups

Suppose two hypothetical groups have measured values in the same units. Group A contains 4 observations with mean 10, while Group B contains 12 observations with mean 16. Find the grand mean, then compare it with the unweighted average of the two group means.

The total sample size is \(N=4+12=16\). The weighted grand mean is

$$ \bar{x} =\frac{4(10)+12(16)}{16} =\frac{40+192}{16} =\frac{232}{16} =14.5. $$

Therefore, the mean of all 16 observations is 14.5 units. The unweighted average of the group means would instead be

$$ \frac{10+16}{2}=13. $$

That value gives each group equal influence despite Group B containing three times as many observations as Group A. It is not the mean of all 16 measurements. The weighted result, 14.5 units, is closer to Group B’s mean because more of the observations come from Group B.

Equal Weighting and Unequal Weighting

An unweighted average of group means answers a different question from the grand mean. It treats each group as one equally important entry, regardless of how many observations the group contains. The grand mean treats each observation equally. When group sizes differ, those two rules of weighting generally produce different answers.

If all groups have the same size, the two calculations agree. If \(n_j=m\) for every group, then the weighted formula simplifies to

$$ \bar{x} =\frac{\sum_{j=1}^{k}m\bar{x}_j}{km} =\frac{1}{k}\sum_{j=1}^{k}\bar{x}_j. $$

So an unweighted average is correct for the grand mean when the group sizes are equal. It can also match by coincidence when group sizes differ, but one should not assume that. The reliable method is to use the sample sizes as weights.

There are situations in which equal weighting of group means is intentional. For example, a question might ask for the average of the group means, with every group counted equally. That is a group-level summary, not the pooled mean of all individual observations. The calculation should match the quantity the question asks for.

Worked Example: Combining Three Group Means

In a hypothetical data set, the response is measured in points. Group 1 has \(n_1=5\) observations and mean \(\bar{x}_1=72\); Group 2 has \(n_2=10\) observations and mean \(\bar{x}_2=78\); Group 3 has \(n_3=15\) observations and mean \(\bar{x}_3=84\). Calculate the grand mean.

First find the total sample size: \(N=5+10+15=30\). The weighted sum of group means is

$$ 5(72)+10(78)+15(84) =360+780+1260 =2400. $$

The grand mean is therefore

$$ \bar{x} =\frac{2400}{30} =80 \text{ points}. $$

For comparison, the unweighted average is \((72+78+84)/3=78\) points. It gives each group equal weight, even though Group 3 contains three times as many observations as Group 1. The pooled mean is 80 points because the larger group means contribute more observations to the combined data.

Calculating From Group Totals

Sometimes a problem provides the sum of observations in each group rather than the group means. In that case, add the group totals and divide by the combined sample size. This is the same calculation: a group total equals its sample size multiplied by its mean. It can be helpful to use whichever information is given, while checking that every group is included exactly once.

Worked Example: Recovering a Grand Mean From Group Totals

A hypothetical experiment records a response in milligrams. Group A has 6 observations with total 42 mg, and Group B has 9 observations with total 81 mg. Find each group mean and the grand mean.

The group means are their totals divided by their sample sizes:

$$ \bar{x}_A=\frac{42}{6}=7\text{ mg}, \qquad \bar{x}_B=\frac{81}{9}=9\text{ mg}. $$

The total sample size is \(N=6+9=15\). Using the group totals directly,

$$ \bar{x} =\frac{42+81}{15} =\frac{123}{15} =8.2\text{ mg}. $$

The weighted-means calculation gives the same result:

$$ \bar{x} =\frac{6(7)+9(9)}{15} =\frac{42+81}{15} =8.2\text{ mg}. $$

The agreement is a useful check: the group means, sample sizes, and totals are consistent. The answer has units of milligrams, the same units as the original measurements.

Understanding the Weights

A weight is a multiplier that determines how much a value contributes to an average. In the grand-mean formula, \(n_j\) is the weight for \(\bar{x}_j\). Dividing each group size by \(N\) gives the group’s share of the full sample, so the same formula can be written as

$$ \bar{x} =\sum_{j=1}^{k}\left(\frac{n_j}{N}\right)\bar{x}_j. $$

The shares \(n_j/N\) are nonnegative and add to 1. A group representing half the observations has weight \(1/2\); a group representing one-tenth has weight \(1/10\). This explains why the grand mean is pulled more toward the means of larger groups.

As a check, a weighted mean with positive weights must lie between the smallest and largest group means. If a calculated grand mean falls outside that range, there is likely an arithmetic error, a transcription error, or a mismatch in the data being combined. This check does not prove the calculation is correct, but it can reveal an impossible result.

The weights are based on the number of observations in each group, not on how variable the measurements are within a group. A group with a small standard deviation does not receive extra weight in this calculation. The task here is to find the arithmetic mean of all observed values, not to estimate a different quantity or to combine estimates using uncertainty-based weights.

Common Mistakes and Checks

  • Averaging the group means equally by default. This works for the grand mean when the group sizes are equal. With unequal sizes, multiply each mean by its group size before combining.
  • Using the number of groups as the denominator. Divide the weighted sum by \(N=\sum n_j\), the number of observations, not by \(k\), the number of groups.
  • Forgetting to check the total sample size. Add all group sizes before dividing. The weights must sum to the denominator.
  • Mixing incompatible measurements. A mean in one unit or for a different response variable cannot be combined directly with means in another unit or for another variable.
  • Confusing a pooled mean with an average across groups. Decide whether the target gives equal importance to each observation or to each group. These are different summaries when group sizes are unequal.
Key takeaway: To find the grand mean across groups, multiply each group mean by its sample size, add those products, and divide by the total sample size. This returns the mean of all observations, giving each observation equal influence.

Check Your Understanding

Use the group sizes as weights whenever the question asks for the mean across all observations.

  1. Group A has 8 observations with mean 12, and Group B has 2 observations with mean 22. What is the grand mean? How does it compare with the unweighted average of the two means?
  2. Why does the unweighted average of group means generally fail to give the mean of all observations when group sizes differ?
  3. Three groups have sample sizes 4, 4, and 4, with means 10, 15, and 20. Explain why the weighted and unweighted averages agree.
  4. A group has 7 observations and mean 6.5. What is the group total represented by that mean?
  5. A calculated grand mean is below every group mean. What does this suggest about the calculation, assuming all group sizes are positive?