Tutorials › ANOVA › Cell-Means Parameterization and Constraints

Two-Factor Main Effects · Tutorial 193 of 595

Cell-Means Parameterization and Constraints

You will translate between cell means and constrained factor effects, and see why the constraints are needed for a unique parameterization.

Intermediate 9 min read

What You'll Learn

  • Write the two-factor fixed-effects model using cell means.
  • Define the grand mean, factor effects, and interaction effects.
  • State the sum-to-zero constraints for both factors and their interaction.
  • Convert a table of cell means into constrained effects and reconstruct the cell means.
  • Explain why the constraints make the effects identifiable.
  • Recognize why an unconstrained decomposition can describe the same means in multiple ways.

Two Ways to Describe the Same Factorial Model

A two-factor experiment can be described by the mean response in every combination of factor levels, or by separating those means into an overall level, contributions associated with each factor, and any remaining joint pattern. These are two parameterizations of the same model: they organize the mean structure differently, but they do not change the predicted mean for any treatment combination.

The second description is useful because it gives names to different parts of the mean pattern. But those names are not automatically unique. A constraint is needed to distinguish, for example, the grand mean from the factor effects. This tutorial develops the connection between the two descriptions and shows how sum-to-zero constraints provide a unique decomposition.

The Cell-Means Model

Let factor A have \(a\) levels and factor B have \(b\) levels. Suppose the design is balanced, with \(n\) observations in each combination of levels. Write \(Y_{ijk}\) for the response from replicate \(k\) in cell \((i,j)\), where \(i=1,\ldots,a\), \(j=1,\ldots,b\), and \(k=1,\ldots,n\). The cell-means model is

$$ Y_{ijk}=\mu_{ij}+\varepsilon_{ijk}. $$

Here \(\mu_{ij}\) is the population mean response at level \(i\) of A and level \(j\) of B. The errors \(\varepsilon_{ijk}\) are assumed independent, normally distributed with mean 0 and common variance \(\sigma^2\). Thus, \(Y_{ijk}\sim N(\mu_{ij},\sigma^2)\). The factors are fixed: the levels in the model are the particular levels of interest, rather than a random sample of possible levels.

This model assigns one mean to each of the \(ab\) cells. It is direct: each parameter answers the question, “What is the mean response in this particular combination of conditions?” A different parameterization expresses those same \(ab\) means using components.

Grand Mean, Factor Effects, and Interaction Effects

In the effects parameterization, the response is written as

$$ Y_{ijk}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\varepsilon_{ijk}. $$

The parameter \(\mu\) is the grand mean. The quantity \(\alpha_i\) is the effect associated with level \(i\) of factor A, and \(\beta_j\) is the effect associated with level \(j\) of factor B. The interaction effect \((\alpha\beta)_{ij}\) is the part of the cell mean that remains after accounting for the grand mean and the two factor effects.

The word “effect” here means a component of the model’s mean structure. In particular, an interaction component describes a departure from an additive pattern of factor contributions; it is not itself a separate cell mean. The cell mean predicted by this model is

$$ \mu_{ij}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}. $$

Without constraints, many different choices of \(\mu\), \(\alpha_i\), \(\beta_j\), and \((\alpha\beta)_{ij}\) can yield the same set of cell means. The conventional sum-to-zero constraints remove this ambiguity:

$$ \sum_{i=1}^{a}\alpha_i=0,\qquad \sum_{j=1}^{b}\beta_j=0, $$ $$ \sum_{i=1}^{a}(\alpha\beta)_{ij}=0\quad\text{for each }j,\qquad \sum_{j=1}^{b}(\alpha\beta)_{ij}=0\quad\text{for each }i. $$

The first two constraints say that the A effects sum to zero across A’s levels and the B effects sum to zero across B’s levels. The interaction constraints require the interaction components to sum to zero down each column and across each row of the cell table. The constraints center the effects around zero, so the grand mean serves as the overall reference level.

Definition: In the sum-to-zero effects parameterization, the cell mean is \(\mu_{ij}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}\), with the A effects, B effects, and interaction components satisfying the stated zero-sum constraints. These restrictions make the decomposition of the cell means unique.

How to Convert Cell Means into Effects

For a balanced factorial table, the constrained parameters can be recovered directly from the cell means. The grand mean is the average of all \(ab\) cell means. The A effect at level \(i\) is the average of the cell means in row \(i\), minus the grand mean; the B effect is defined analogously using column \(j\). The interaction is what remains in a cell after subtracting the grand mean and its two factor effects.

$$ \mu=\frac{1}{ab}\sum_{i=1}^{a}\sum_{j=1}^{b}\mu_{ij}, \qquad \alpha_i=\frac{1}{b}\sum_{j=1}^{b}\mu_{ij}-\mu, $$ $$ \beta_j=\frac{1}{a}\sum_{i=1}^{a}\mu_{ij}-\mu, \qquad (\alpha\beta)_{ij}=\mu_{ij}-\mu-\alpha_i-\beta_j. $$

The row and column averages here give each level of the other factor equal weight. That matches the balanced design, in which every cell has the same number of observations. The formulas describe the model parameters; for an observed dataset, the cell sample means can be substituted to calculate the corresponding fitted effects.

1
Average all cell means.
This gives \(\mu\), the grand mean.
2
Center each row and column average.
Subtract \(\mu\) from a row average to get \(\alpha_i\), and from a column average to get \(\beta_j\).
3
Calculate the remaining cell-specific component.
Subtract \(\mu\), \(\alpha_i\), and \(\beta_j\) from \(\mu_{ij}\) to get \((\alpha\beta)_{ij}\).
4
Check the constraints.
The A effects and B effects should each sum to zero, and interaction components should sum to zero within every row and column.

Worked Conversions

Worked Example: Decomposing a Two-by-Two Table

Suppose a hypothetical balanced experiment has the following cell means, measured in points:

B level 1B level 2
A level 11014
A level 21622

First calculate the grand mean:

$$ \mu=\frac{10+14+16+22}{4}=15.5\text{ points}. $$

The row averages are \(12\) and \(19\), so the A effects are \(12-15.5=-3.5\) points and \(19-15.5=3.5\) points. The column averages are \(13\) and \(18\), giving B effects \(13-15.5=-2.5\) points and \(18-15.5=2.5\) points. Each pair sums to zero.

For the first cell, the interaction component is \(10-15.5-(-3.5)-(-2.5)=0.5\) points. Applying the same calculation to all four cells gives:

$$ \begin{array}{c|rr} &\text{B level 1}&\text{B level 2}\\ \hline \text{A level 1}&0.5&-0.5\\ \text{A level 2}&-0.5&0.5 \end{array} $$

The interaction components sum to zero in each row and column. Reconstructing the first cell gives \(15.5-3.5-2.5+0.5=10\) points. For the cell at A level 2 and B level 2, the reconstruction is \(15.5+3.5+2.5+0.5=22\) points. The other two cells likewise reproduce the given means.

Worked Example: Checking Constraints in a Three-by-Two Table

Consider this hypothetical table of cell means, measured in milligrams:

B level 1B level 2
A level 1810
A level 21216
A level 31618

The grand mean is \(80/6=13.333\) milligrams. The row averages are \(9\), \(14\), and \(17\), so the A effects are \(-4.333\), \(0.667\), and \(3.667\) milligrams. Their sum is \(0\). The column averages are \(12\) and \(44/3=14.667\), so the B effects are \(-1.333\) and \(1.333\) milligrams; these also sum to \(0\).

The interaction in the first cell is \(8-13.333-(-4.333)-(-1.333)=0.333\) milligrams. Calculating the other cells gives the interaction table:

$$ \begin{array}{c|rr} &\text{B level 1}&\text{B level 2}\\ \hline \text{A level 1}&0.333&-0.333\\ \text{A level 2}&-0.667&0.667\\ \text{A level 3}&0.333&-0.333 \end{array} $$

Every row sums to zero, and each column sums to zero. As a reconstruction check, the fitted mean for A level 2 and B level 2 is \(13.333+0.667+1.333+0.667=16.000\) milligrams, matching the table. Rounding explains any tiny discrepancies that could arise if rounded component values were used in further calculations.

Why the Constraints Give Identifiability

A parameterization is identifiable when distinct allowed parameter values cannot describe the same model means. Here the constraints make the grand mean and effects uniquely recoverable from the cell means. A short derivation verifies this claim and shows why the component formulas work.

1
Average the model over all cells.
In \(\mu_{ij}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}\), the average of the A effects is zero, as is the average of the B effects. The interaction terms also average to zero by the row and column constraints. Therefore the average cell mean equals \(\mu\).
2
Average across a row.
For fixed \(i\), the row average of \(\mu_{ij}\) is \(\mu+\alpha_i\): the B effects average to zero, and the interaction components in that row sum to zero. Subtracting \(\mu\) leaves \(\alpha_i\).
3
Average down a column.
For fixed \(j\), the column average of \(\mu_{ij}\) is \(\mu+\beta_j\), because the A effects and the interaction components in that column sum to zero. Subtracting \(\mu\) leaves \(\beta_j\).
4
Recover the interaction.
Once \(\mu\), \(\alpha_i\), and \(\beta_j\) are determined, the cell equation forces \((\alpha\beta)_{ij}=\mu_{ij}-\mu-\alpha_i-\beta_j\). There is no remaining choice of components that preserves both the cell means and the constraints.

This argument also explains the role of the balanced layout in these formulas: averaging equally over the other factor’s levels is straightforward because all cells have the same replication. The focus here is the parameterization and its constraints, not a test of whether any component differs from zero.

Worked Example: Seeing the Ambiguity Without a Constraint

Suppose a hypothetical two-by-two set of cell means is generated by \(\mu=10\) points, A effects \((-1,1)\) points, B effects \((-2,2)\) points, and zero interaction. The predicted means are \(7,11,9,13\) points, in row order.

Now change the grand mean to \(13\) points and change the two A components to \((-4,-2)\) points, leaving the B effects and interactions unchanged. The first row still has means \(13-4-2=7\) and \(13-4+2=11\); the second has means \(13-2-2=9\) and \(13-2+2=13\). Thus both sets of parameters describe exactly the same cell means.

The second set is not a valid sum-to-zero effects parameterization: its A components sum to \(-6\) points, rather than zero. This example shows why the cell predictions alone do not identify unconstrained components. The constraints select one decomposition: in the first set, the A effects and B effects each sum to zero, and the grand mean is the average of the four cell means.

Common Mistake and Why This Matters

A frequent mistake is to treat the grand mean and the factor effects as uniquely determined before stating constraints. For example, one might shift a constant from every A effect into the grand mean and assume that the new effects have the same interpretation. The cell means can indeed remain unchanged, but the effect components have changed; without a rule such as sum-to-zero, there is no unique decomposition.

A related error is to assume that an interaction component is simply the cell mean or that the grand mean is one particular cell mean. Neither is correct. The interaction is the remainder after subtracting the grand mean and the two factor effects, while the grand mean is the average across all cells under the balanced, equal-level convention used here.

Key takeaway: The cell-means and effects parameterizations describe the same \(ab\) cell means. Under sum-to-zero constraints, the grand mean, factor effects, and interaction components are uniquely determined, and their contributions reconstruct every cell mean.

Check Your Understanding

Use the definitions and constraints in this tutorial to answer the following questions.

  1. In the cell-means model, what does \(\mu_{ij}\) represent, and what assumptions are made about the errors?
  2. For a balanced two-factor table, how is \(\alpha_i\) calculated from the cell means?
  3. What must be true of the interaction components when summed across a row or down a column?
  4. Why can two different unconstrained collections of components produce the same cell means?
  5. If the A effects are \(-2\), \(0\), and \(2\) points, do they satisfy the A sum-to-zero constraint? What does that constraint require?
Clinical Biostats