A main effect is the average change in the response when one factor moves from one level to another, averaged over all levels of the other factors. It is the first number most experiments report: if switching a chamber from low to high temperature changes the response by $+15$ units on average across gas mixtures, then $+15$ is the main effect of temperature. The words "on average" are the whole story, and they are also how a main effect can mislead.
The calculation takes the cell means, averages over the other factor, and subtracts. It ends with a check that decides whether the average can be trusted:
How a main effect is defined. For a two-level factor A in a balanced design with cell means $\bar{y}_{ab}$, where $-$ and $+$ denote the low and high levels, the main effect is the difference between the two marginal means. Equivalently, it is the average of the factor's simple effects, one at each level of B:
In the coded $\pm1$ regression model $y=\beta_0+\beta_A x_A+\beta_B x_B+\beta_{AB}x_Ax_B+\varepsilon$, the coefficient is half the effect, $\beta_A=\mathrm{ME}_A/2$, because $x_A$ moves two coded units from $-1$ to $+1$. With $n_{A+}$ and $n_{A-}$ observations at the two levels and error variance estimated by $MS_E$ on $\nu$ degrees of freedom, the standard error and interval are:
For a factor with more than two levels there is one effect per level, $\alpha_i=\bar{y}_{i\cdot\cdot}-\bar{y}$, and the overall test is the F-test on the factor's sum of squares from the two-way ANOVA.
The diagram shows why the averaging step matters. Both panels have exactly the same main effect of A, $+15$, but only the left one describes what happens at every level of B:
Worked example. This is the same experiment used for the interaction effect: two temperature levels (A), two gas mixtures (B, with X as $-$ and Y as $+$), and $r=2$ wafers per cell, with cell means $40,\,50,\,45,\,75$ in the order A$-$B$-$, A$-$B$+$, A$+$B$-$, A$+$B$+$. The temperature means are $45$ and $60$, so $\mathrm{ME}_A=15$; the mixture means are $42.5$ and $62.5$, so $\mathrm{ME}_B=20$. The error mean square is $MS_E=8$ on $4$ degrees of freedom, and each marginal mean uses $2r=4$ wafers, so $\mathrm{SE}(\mathrm{ME})=\sqrt{8}\sqrt{1/4+1/4}=2$.
| Effect | Calculation | Estimate | Standard error | 95% interval |
|---|---|---|---|---|
| Temperature (A) | $60-45$ | $15$ | $2$ | $[9.45,\,20.55]$ |
| Gas mixture (B) | $62.5-42.5$ | $20$ | $2$ | $[14.45,\,25.55]$ |
| A × B contrast | $(75-50)-(45-40)$ | $20$ | $4$ | $[8.89,\,31.11]$ |
The test statistics are $t=15/2=7.5$ ($p\approx0.0017$) for temperature and $t=20/2=10$ ($p\approx0.0006$) for the mixture, so both main effects are clearly larger than the noise. The last row is the interaction contrast, which has twice the standard error because it compares four cell means instead of two marginal means:
When the average is safe. The interaction interval also excludes zero. Temperature adds $+5$ at mixture X and $+25$ at mixture Y, so the main effect of $+15$ is accurate for neither mixture. It is a fair summary only when the simple effects are close to each other.
- Parallel profiles: report the main effect with its interval, and say that the other factor does not change it materially.
- Interaction present: report the simple effects, or the cell means with intervals, and treat the main effect as a weighted average.
- Crossover: if the simple effects are $+5$ and $-5$, the main effect of A is exactly $0$ even though A matters in opposite directions at each level of B.
- Unbalanced data: raw marginal means weight each cell by its sample size, whereas the model-based main effect weights cells equally. Decide which one answers the question and state it.
- Size matters: a main effect with a small p-value can still be too small to act on; report the estimate in response units with its interval.
Read a main effect as the average shift in the response when one factor changes with the others averaged out: a fair summary when the lines are parallel, and a blurred one when they are not.