Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Factorial Experiments & Interaction

A factorial experiment studies combinations of two or more design factors. It asks how each factor changes the response and whether its effect depends on another factor.

This extends One-Way ANOVA: a second factor can be a scientific treatment factor, rather than merely a nuisance variable to remove.

DesignTreatment combinationsMain question
Two factors with aa and bb levelsababWhat are the effects of A, B, and their interaction?
Three factors with a,b,ca,b,c levelsabcabcDoes a two-factor interaction depend on the third factor?
kk factors, each with two levels2k2^kWhich factors and interactions are active over the chosen ranges?

With nn independent replicates per combination, multiply the number of combinations by nn to obtain the total run count. All raw numerical data used below are illustrative.

Why Vary Factors Together?

Suppose A is a process setting and B is a temperature setting. Changing A only at low B tells us its effect at low B. It cannot show whether A behaves differently at high B.

A factorial design includes every combination, allowing us to estimate both main effects and interactions. Each run contributes to several comparisons. The cost is that the run count grows as the product of the numbers of levels.

Choose factors and ranges with a scientific purpose. A low/high difference that is too small may be practically uninformative; a very wide range can make a simple model inappropriate. Randomize execution order and use independent experimental units.

Main Effects, Simple Effects & Interaction

QuantityMeaning
Simple effect of AChange in mean response across A levels at a particular level of B.
Main effect of AA comparison averaged over B levels, using the stated weighting.
InteractionThe simple effect of A changes with B; equivalently, B’s effect changes with A.

For a balanced two-by-two design, let μij\mu_{ij} denote the mean at A level ii and B level jj. The simple effects of increasing A are

ΔA(B1)=μ21−μ11,ΔA(B2)=μ22−μ12.\Delta_A(B_1)=\mu_{21}-\mu_{11},\qquad \Delta_A(B_2)=\mu_{22}-\mu_{12}.

Their difference is the difference of differences:

DAB=(μ22−μ12)−(μ21−μ11).D_{AB}=(\mu_{22}-\mu_{12})-(\mu_{21}-\mu_{11}).

No interaction means DAB=0D_{AB}=0. In an interaction plot, parallel population-mean lines indicate additivity. Sample lines need not be perfectly parallel even when the population model is additive.

Additive, changing-size, and crossover interaction patterns.

Nonparallel lines need not cross to indicate interaction. A crossover can make an average main effect near zero even when the factor matters greatly within each condition. A plot suggests patterns; inferential uncertainty still matters.

Replicated Two-Factor Model

For A levels i=1,…,ai=1,\ldots,a, B levels j=1,…,bj=1,\ldots,b, and independent replicates r=1,…,nr=1,\ldots,n,

Yijr=μ+αi+βj+(αβ)ij+εijr,Y_{ijr}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\varepsilon_{ijr},
εijr∼iidN(0,σ2).\varepsilon_{ijr}\overset{\mathrm{iid}}{\sim}N(0,\sigma^2).

The usual constraints are

∑iαi=0,∑jβj=0,\sum_i\alpha_i=0,\qquad\sum_j\beta_j=0,
∑i(αβ)ij=0 for each j,∑j(αβ)ij=0 for each i.\sum_i(\alpha\beta)_{ij}=0\ \text{for each }j,\qquad \sum_j(\alpha\beta)_{ij}=0\ \text{for each }i.

These constraints make the parameterization identifiable. The cell mean is

μij=μ+αi+βj+(αβ)ij.\mu_{ij}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}.
Sample meanAverage over
Yˉij⋅\bar Y_{ij\cdot}Replicates in cell (i,j)(i,j).
Yˉi⋅⋅\bar Y_{i\cdot\cdot}All B levels and replicates at A level ii.
Yˉ⋅j⋅\bar Y_{\cdot j\cdot}All A levels and replicates at B level jj.
Yˉ⋅⋅⋅\bar Y_{\cdot\cdot\cdot}All N=abnN=abn observations.

For this balanced design,

μ^=Yˉ⋅⋅⋅,α^i=Yˉi⋅⋅−Yˉ⋅⋅⋅,β^j=Yˉ⋅j⋅−Yˉ⋅⋅⋅,\widehat\mu=\bar Y_{\cdot\cdot\cdot},\quad \widehat\alpha_i=\bar Y_{i\cdot\cdot}-\bar Y_{\cdot\cdot\cdot},\quad \widehat\beta_j=\bar Y_{\cdot j\cdot}-\bar Y_{\cdot\cdot\cdot},
(αβ)^ij=Yˉij⋅−Yˉi⋅⋅−Yˉ⋅j⋅+Yˉ⋅⋅⋅.\widehat{(\alpha\beta)}_{ij} =\bar Y_{ij\cdot}-\bar Y_{i\cdot\cdot}-\bar Y_{\cdot j\cdot}+\bar Y_{\cdot\cdot\cdot}.

Thus Y^ijr=Yˉij⋅\widehat Y_{ijr}=\bar Y_{ij\cdot} and eijr=Yijr−Yˉij⋅e_{ijr}=Y_{ijr}-\bar Y_{ij\cdot}. The interaction is the cell mean’s departure from what the additive main-effects model predicts.

Two-Factor ANOVA

For equal replication, variation splits into four orthogonal components:

SST=SSA+SSB+SSAB+SSE.SS_T=SS_A+SS_B+SS_{AB}+SS_E.
SSA=bn∑i(Yˉi⋅⋅−Yˉ⋅⋅⋅)2,SSB=an∑j(Yˉ⋅j⋅−Yˉ⋅⋅⋅)2,SSAB=n∑i,j(Yˉij⋅−Yˉi⋅⋅−Yˉ⋅j⋅+Yˉ⋅⋅⋅)2,SSE=∑i,j,r(Yijr−Yˉij⋅)2.\begin{aligned} SS_A&=bn\sum_i(\bar Y_{i\cdot\cdot}-\bar Y_{\cdot\cdot\cdot})^2,\\ SS_B&=an\sum_j(\bar Y_{\cdot j\cdot}-\bar Y_{\cdot\cdot\cdot})^2,\\ SS_{AB}&=n\sum_{i,j}\left(\bar Y_{ij\cdot}-\bar Y_{i\cdot\cdot}-\bar Y_{\cdot j\cdot}+\bar Y_{\cdot\cdot\cdot}\right)^2,\\ SS_E&=\sum_{i,j,r}(Y_{ijr}-\bar Y_{ij\cdot})^2. \end{aligned}
SourcedfMean squareTest
Aa−1a-1MSA=SSA/(a−1)MS_A=SS_A/(a-1)FA=MSA/MSEF_A=MS_A/MSE
Bb−1b-1MSB=SSB/(b−1)MS_B=SS_B/(b-1)FB=MSB/MSEF_B=MS_B/MSE
AB(a−1)(b−1)(a-1)(b-1)MSAB=SSAB/[(a−1)(b−1)]MS_{AB}=SS_{AB}/[(a-1)(b-1)]FAB=MSAB/MSEF_{AB}=MS_{AB}/MSE
Errorab(n−1)ab(n-1)MSE=SSE/[ab(n−1)]MSE=SS_E/[ab(n-1)]
Totalabn−1abn-1

Each test uses its row’s df in the numerator and the error df in the denominator, with right-tail rejection. The hypotheses are all A effects zero, all B effects zero, and all interaction effects zero, respectively. With interactions present, main-effect hypotheses concern marginal averages, not absence of every simple effect.

These simple SS formulas rely on balance. For unequal replication or missing cells, fit the appropriate linear model and specify the desired comparisons and weighting; different adjusted ANOVA hypotheses need not coincide.

Interpreting & Checking the Model

  1. Inspect cell means and interaction plots. Begin interpretation with the highest-order interaction retained in the model.

  2. Describe relevant simple effects when averages hide important differences.

  3. Use planned contrasts or adjusted comparisons when several conclusions are intended jointly.

  4. Check residual normality, spread across cells, outliers, and patterns over run order. Independence comes from the assignment and measurement design.

  5. Report effects in response units, uncertainty, and the combinations actually studied.

Model hierarchy: retain the main effects A and B when retaining AB, even if one marginal test is nonsignificant. A nonsignificant interaction is not proof of additivity, especially with little replication.

Reference-group coding, sum-to-zero coding, and a separate parameter for each cell describe the same full cell-means model. Fitted values and residuals agree; coefficients have different interpretations. In reference coding, the intercept can be a baseline cell mean rather than the grand mean.

What Changes Without Replication?

With one observation per cell, N=abN=ab. The full interaction model fits every cell exactly and leaves zero pure-error df. Interaction can be described from cell values, but it cannot be tested against a separately estimated within-cell error variance from those data alone.

If additivity is scientifically defensible, fit

Yij=μ+αi+βj+εij.Y_{ij}=\mu+\alpha_i+\beta_j+\varepsilon_{ij}.

The fitted value is Yˉi⋅+Yˉ⋅j−Yˉ⋅⋅\bar Y_{i\cdot}+\bar Y_{\cdot j}-\bar Y_{\cdot\cdot}. The remaining (a−1)(b−1)(a-1)(b-1) df can serve as residual error under the no-interaction assumption. Any actual interaction is then mixed into that residual.

One observation per cellWhat can be done?
Fit all cell means / full interactionEstimate cell means; no internal pure-error estimate.
Fit an additive modelTest main effects conditionally on additivity and the error assumptions.
Obtain genuine replication or external error informationSupply information needed to separate interaction from noise.

Do not declare an interaction absent simply because a design cannot test it.

Quantitative Factors: Polynomial Components

For three equally spaced numerical levels, use linear coefficients L=(−1,0,1)L=(-1,0,1) and quadratic coefficients Q=(1,−2,1)Q=(1,-2,1). Each factor’s two df split into one linear and one quadratic component.

For A, with bnbn observations contributing to each marginal mean,

CA=∑iuiμi⋅,SE⁡(C^A)=MSEbn∑iui2.C_A=\sum_i u_i\mu_{i\cdot},\qquad \operatorname{SE}(\widehat C_A)=\sqrt{\frac{MSE}{bn}\sum_i u_i^2}.

For an interaction component, take an outer product of contrast coefficients:

Cuv=∑i,juivjμij,SE⁡(C^uv)=MSEn(∑iui2)(∑jvj2).C_{uv}=\sum_{i,j}u_i v_j\mu_{ij},\qquad \operatorname{SE}(\widehat C_{uv})=\sqrt{\frac{MSE}{n}\left(\sum_i u_i^2\right)\left(\sum_j v_j^2\right)}.

For example, A-linear × B-quadratic uses

LQT=(−12−10001−21).LQ^\mathsf T=\begin{pmatrix}-1&2&-1\\0&0&0\\1&-2&1\end{pmatrix}.

The four interaction components L×LL\times L, L×QL\times Q, Q×LQ\times L, and Q×QQ\times Q partition the four interaction df in the balanced 3×33\times3 design. Each can be tested as a one-df contrast using the common MSE; adjust for multiplicity when making joint claims.

Polynomial contrasts require quantitative levels. The displayed coefficients assume equal spacing and balanced replication; arbitrary category labels do not have a linear or quadratic trend.

When Replicate Groups Are Blocks

If each complete factorial replicate was run in a different batch or week, the replicate index may represent a nuisance block. With rr complete blocks, one observation per treatment combination in each block, use

Yijℓ=μ+αi+βj+(αβ)ij+γℓ+εijℓ.Y_{ij\ell}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\gamma_\ell+\varepsilon_{ij\ell}.

The balanced decomposition adds block SS with r−1r-1 df. The residual df becomes

abr−1−(ab−1)−(r−1)=(ab−1)(r−1).abr-1-(ab-1)-(r-1)=(ab-1)(r-1).

For a 3×33\times3 factorial in two complete blocks, residual df is 8, compared with 9 when the two replicates are treated as unstructured replication. The treatment SS remain unchanged in this balanced orthogonal layout; MSE changes.

This model assumes treatment-block interactions are negligible. Without replication within each treatment-block cell, general treatment-block interactions cannot be separated from pure error. Design the blocking and randomization before collecting data.

More Than Two Factors

With three design factors, the full model includes A, B, C, AB, AC, BC, and ABC. An ABC interaction means that the AB interaction changes across C levels.

Termdf
A, B, Ca−1a-1, b−1b-1, c−1c-1
AB, AC, BC(a−1)(b−1)(a-1)(b-1), (a−1)(c−1)(a-1)(c-1), (b−1)(c−1)(b-1)(c-1)
ABC(a−1)(b−1)(c−1)(a-1)(b-1)(c-1)
Error with nn replicates per cellabc(n−1)abc(n-1)

The model’s non-intercept df sum to abc−1abc-1. With n=1n=1, all df are consumed: more factors do not remove the need for replication or justified error assumptions.