Tutorials › ANOVA › Common Mistakes with Unequal Cell Sizes

Unequal Cell Sizes · Tutorial 249 of 595

Common Mistakes with Unequal Cell Sizes

Recognize how unequal cell sizes affect factorial summaries and correct common mistakes by stating the relevant means, precision, assumptions, and weights.

Intermediate 9 min read

What You'll Learn

  • Distinguish a cell mean from a marginal mean in a factorial design.
  • Calculate observed-sample and equal-weight marginal means and explain what each summarizes.
  • Explain why cell means based on different sample sizes have different precision.
  • Check orthogonality using factor coding and cell counts.
  • State the weights behind a reported overall or marginal average.
  • Correct common interpretations that ignore imbalance or hide the target population.

Why Unequal Cell Sizes Invite Mistakes

In a factorial ANOVA, a cell is one combination of factor levels. When cell sizes differ, summaries that look similar can answer different questions: an average across observed individuals may give more influence to heavily sampled cells, while an average of cell means may give every cell equal influence. Cell means may also have different precision, and the factors need not be orthogonal. Avoiding mistakes starts with naming exactly what is being averaged and how it is weighted.

The examples use a two-factor design to make these issues visible. The same principles apply to designs with more factors: a marginal mean averages across combinations of the other factors, so the averaging weights matter.

Set Up the Cell-Means Model

Let \(i\) index the levels of factor A, \(j\) index the levels of factor B, and \(k\) index observations within a cell. Write \(n_{ij}\) for the number of observations in cell \((i,j)\), and \(\bar{x}_{ij}\) for that cell's sample mean. The corresponding population cell mean is \(\mu_{ij}\).

Model and assumptions: For the examples, use the cell-means model \(X_{ijk}=\mu_{ij}+\varepsilon_{ijk}\). The errors are independent, have mean zero, and have a common variance \(\sigma^2\); when a normal-theory calculation is used, assume \(\varepsilon_{ijk}\sim N(0,\sigma^2)\). This model allows the cell means to reflect an interaction. Independence and a common within-cell variance are important for the standard-error calculations below; the normality condition supports exact normal-theory inference.

A cell mean summarizes the observations in one specific combination of factor levels. A marginal mean summarizes across levels of another factor. In an unbalanced design, “the marginal mean” is incomplete unless the weights are specified. An observed-sample marginal mean uses the cell counts in the sample; an equal-weight marginal mean gives each included cell the same weight. Either can be useful, but they need not be equal or answer the same question.

Mistake 1: Treating a Marginal Mean as a Cell Mean

A cell mean belongs to one cell, such as the mean for A1 and B2. A marginal mean combines results from multiple cells, so it cannot be used as though it described one particular combination. This distinction matters especially when cell means differ across levels of a factor.

Worked Example: Separating Cell Means From Marginal Means

Suppose a hypothetical study records a score, in points, for two levels of A and two levels of B. The cell summaries are:

CellSample size \(n_{ij}\)Cell mean \(\bar{x}_{ij}\) (points)
A1, B12010
A1, B2514
A2, B1512
A2, B22016

The cell mean for A1, B2 is 14 points. It is not the same as the marginal mean for A1, which combines the A1, B1 and A1, B2 cells. Weighting by the observed numbers of people gives

$$ \bar{x}_{A1,\mathrm{observed}} =\frac{20(10)+5(14)}{20+5} =\frac{270}{25} =10.8\text{ points}. $$

For A2, the corresponding observed-sample marginal mean is

$$ \bar{x}_{A2,\mathrm{observed}} =\frac{5(12)+20(16)}{5+20} =\frac{380}{25} =15.2\text{ points}. $$

If the intended summary instead gives B1 and B2 equal weight within each A level, the averages are \( (10+14)/2=12 \) points for A1 and \( (12+16)/2=14 \) points for A2. These are different summaries from the observed-sample marginal means. The cell means themselves remain 10, 14, 12, and 16 points; averaging them does not turn a marginal mean into a cell mean.

Correction: Identify the cell when describing a cell mean, and name the averaging rule when describing a marginal mean. Do not label 10.8 points as “the A1, B2 mean”; that cell mean is 14 points.

Mistake 2: Assuming All Cell Means Are Equally Precise

A mean based on more observations is generally more precise than a mean based on fewer observations, provided observations have the same variance and meet the independence assumptions. Treating all cell means as equally precise can therefore misrepresent how much information each one contains.

Result: Under the model above, the variance of a cell sample mean is \(\operatorname{Var}(\bar{x}_{ij})=\sigma^2/n_{ij}\). If the common within-cell standard deviation is estimated by \(s\), its estimated standard error is \(SE(\bar{x}_{ij})=s/\sqrt{n_{ij}}\).

The reason follows from independence. A cell mean is the average of \(n_{ij}\) observations, so its error is the average of \(n_{ij}\) independent errors. The variance of a sum of independent errors is the sum of their variances; dividing that sum by \(n_{ij}^2\) gives

$$ \operatorname{Var}(\bar{x}_{ij}) =\operatorname{Var}\left(\frac{1}{n_{ij}}\sum_{k=1}^{n_{ij}}X_{ijk}\right) =\frac{1}{n_{ij}^2}\left(n_{ij}\sigma^2\right) =\frac{\sigma^2}{n_{ij}}. $$

Taking the square root gives the standard deviation of the cell mean, \(\sigma/\sqrt{n_{ij}}\), and replacing \(\sigma\) by a suitable estimate \(s\) gives its estimated standard error. This calculation relies on independent observations with a common variance; unequal sample sizes alone do not justify different variance assumptions, but they do produce different standard errors under this model.

Worked Example: Comparing Cell-Mean Precision

Suppose two hypothetical cells measure recovery time in days. The first has \(n_1=4\) observations and the second has \(n_2=16\). Assume independent observations and a common within-cell standard deviation estimated as \(s=4\) days.

For the first cell, the estimated standard error of its sample mean is

$$ SE(\bar{x}_1)=\frac{s}{\sqrt{n_1}} =\frac{4}{\sqrt{4}} =2\text{ days}. $$

For the second cell, it is

$$ SE(\bar{x}_2)=\frac{s}{\sqrt{n_2}} =\frac{4}{\sqrt{16}} =1\text{ day}. $$

The second mean has half the estimated standard error, not because its mean must be closer to the population mean in this particular sample, but because a sample of 16 observations has greater precision than a sample of 4 under the stated model. Both estimates use the same \(s\), units, and assumptions; the difference comes from \(n\).

Correction: Do not treat the two sample means as equally precise just because both are means in a factorial table. Report or account for their sample sizes when evaluating their uncertainty.

Mistake 3: Assuming Unequal Designs Are Orthogonal

In a balanced factorial design, factor comparisons can have convenient orthogonality properties. Unequal cell counts can remove those properties: information about one factor may no longer be separated cleanly from information about another. A useful check is to code the two factor levels as \(-1\) and \(+1\). The cross-product of the two coded columns is the sum of the products of their codes across observations. If it is not zero, those columns are not orthogonal in the observed design.

Worked Example: Checking Orthogonality From Cell Counts

Consider hypothetical counts of 18, 2, 2, and 18 observations in cells A1B1, A1B2, A2B1, and A2B2, respectively. Code A1 and B1 as \(-1\), and A2 and B2 as \(+1\). The product of the A and B codes is \(+1\) in A1B1 and A2B2, and \(-1\) in A1B2 and A2B1. Thus the cross-product is

$$ \sum AB =18(+1)+2(-1)+2(-1)+18(+1) =18-2-2+18 =32. $$

Since this cross-product is not zero, the coded factor columns are not orthogonal in this design. In contrast, with equal counts in all four cells, the positive and negative products would cancel. Here the large counts are concentrated in the two cells where A and B have matching codes.

This is a design-level warning, not a claim that every analysis must use one particular adjustment or that the factors are causally related. It means that an analyst should not assume that a comparison involving one factor is automatically independent of how the other factor is represented. The design and the question being asked must guide the analysis.

Correction: Check the cell-count pattern before assuming orthogonality. In an unbalanced design, avoid reasoning that depends on factor effects being separated automatically.

Mistake 4: Reporting an Average Without Its Weights

A weighted average has a precise interpretation only when its weights are clear. The observed-sample grand mean weights each cell by its number of observations. An equal-cell grand mean weights each cell equally. They summarize different target compositions when counts differ. Neither is universally correct: choose weights that match the question, and state them.

Worked Example: Naming the Weights Behind an Overall Average

Use the counts in the orthogonality example, and suppose the hypothetical cell means, in points, are 10 for A1B1, 14 for A1B2, 12 for A2B1, and 20 for A2B2. The observed-sample grand mean weights each cell mean by its cell count:

$$ \bar{x}_{\mathrm{observed}} =\frac{18(10)+2(14)+2(12)+18(20)}{18+2+2+18} =\frac{592}{40} =14.8\text{ points}. $$

An equal-cell grand mean instead gives each of the four cell means weight \(1/4\):

$$ \bar{x}_{\mathrm{equal\ cells}} =\frac{10+14+12+20}{4} =\frac{56}{4} =14\text{ points}. $$

The difference, 14.8 versus 14 points, reflects different weights, not an arithmetic error. The first summarizes the observed sample composition; the second summarizes a hypothetical composition with equal representation from each cell. If the goal is to describe the observed sample, the first weighting is natural. If the goal is a comparison standardized to equal cell representation, the second may be relevant. The intended target must be stated rather than inferred from the number alone.

Correction: When reporting a grand or marginal average, give the weighting rule in words or in the formula. “The average was 14.8 points” is less informative than “the observed-sample grand mean, weighted by the cell counts, was 14.8 points.”

A Short Audit Before Interpreting a Summary

These errors can be caught by asking a few precise questions before writing an interpretation. The goal is not to calculate every possible summary; it is to make sure the reported number corresponds to the intended quantity and that its uncertainty is not hidden.

1
Name the quantity.
Is the number a cell mean, a marginal mean, or a grand mean? Identify the factor levels or combinations it summarizes.
2
State the weights.
Say whether cells are weighted by their observed counts, equally, or by another stated target composition.
3
Check precision assumptions.
Compare cell sizes and use a standard-error calculation only when its independence and variance assumptions are reasonable.
4
Check the design structure.
Do not assume orthogonality from the factorial layout alone; inspect the cell counts and the coding or comparisons being used.

Common Mistakes and Their Corrections

  • Wrong: “The A1 mean is the A1B2 cell mean.” Correction: The A1 marginal mean combines cells across B; the A1B2 mean refers to that one cell.
  • Wrong: “Each cell mean is equally precise because each is one number.” Correction: Under the common-variance model, the standard error depends on the cell size through \(s/\sqrt{n_{ij}}\).
  • Wrong: “The factors are orthogonal because this is a factorial design.” Correction: Unequal cell counts can make factor columns nonorthogonal; check the design rather than assuming balance.
  • Wrong: “The overall mean is 14.8 points,” with no further description. Correction: State that it is the observed-sample mean weighted by cell counts, or name the alternative weights used.
  • Wrong: “The observed-sample weighted mean is always the right marginal mean.” Correction: It answers a question about the observed composition; a different target composition may require different weights.
Key takeaway: With unequal cell sizes, always distinguish cell means from averages across cells, account for differences in precision, check rather than assume orthogonality, and state the weights behind every marginal or overall average.

Check Your Understanding

Use the definitions and examples above to answer these questions.

  1. A researcher reports a mean for level A1 that combines observations from B1 and B2. Is this a cell mean or a marginal mean? What additional information would help interpret it?
  2. Under the common-variance model, compare the estimated standard errors of two cell means with sample sizes 9 and 36, when \(s=6\) units.
  3. With cell counts 10, 10, 10, and 10 in a two-by-two design, what is the cross-product of the \(-1,+1\) coded A and B columns?
  4. Explain the difference between an observed-sample grand mean and an equal-cell grand mean.
  5. Why is it misleading to call a weighted average “the marginal mean” without stating how its cell weights were chosen?
Clinical Biostats