Why imbalance changes the ANOVA question
In a balanced crossover ANOVA, the design often makes the fitted effects orthogonal: the information attributed to one term does not depend on which other term is entered first. Missing periods, unequal sequence sizes, or other imbalances can destroy that separation. Then a single phrase such as “the treatment sum of squares” is incomplete. The value depends on which model comparison is being made.
The practical issue is not just software terminology. A test of treatment after adjusting for period asks a different question from a treatment test that first absorbs variation in sequence or subject. The contrast also matters: an average treatment effect that weights both periods equally need not be the same target as an average weighted by the observed period distribution.
Model, assumptions, and the meaning of adjustment
For the fixed-effects part of a crossover analysis, write the log-scale endpoint vector as \(y=X\beta+\varepsilon\). The design matrix \(X\) represents the specified terms, such as sequence, period, treatment, and subject nested within sequence. A treatment hypothesis is expressed as a contrast, or more generally a set of contrasts, \(H_0:L\beta=0\). The rows of \(L\) specify which linear combinations of model coefficients are being tested.
The ordinary least-squares sums-of-squares calculations below assume a correctly specified linear model, independent errors with mean zero and common variance, and full column rank for the model being fitted. For an exact classical \(F\) test, the errors are also normally distributed. Crossover measurements from the same subject are generally correlated, so independence is not a safe assumption if subject structure is omitted. The model must represent that structure, and the appropriate error term and degrees of freedom must be chosen as established in the earlier material on crossover ANOVA. The sums-of-squares comparison alone does not validate an ordinary \(F\) test for a mixed model.
For a fixed-effects least-squares comparison, let \(RSS_R\) and \(RSS_F\) be the residual sums of squares for the reduced and full models. If adding a term contributes \(q\) estimable parameters, its partial sum of squares is \(RSS_R-RSS_F\), and the usual fixed-effects test statistic is \((RSS_R-RSS_F)/q\) divided by the full-model residual mean square. This comparison is meaningful only when the hypotheses are estimable and the models are nested.
Sequential sums of squares: order is part of the definition
A sequential analysis assigns each term the additional reduction in residual variation at the point where that term enters. If treatment is entered first, its sequential sum of squares is not generally the same as its sum of squares when it is entered after period. In an orthogonal balanced design the reductions can coincide; in an unbalanced design, terms can explain some of the same variation.
Worked Example: Changing the Order Changes the Sequential Sum of Squares
Consider a hypothetical illustration of the treatment and period columns after common model terms have been removed. The four coordinates below are contrast-space values, not four raw subject records. Let \(x\) represent a treatment contrast, \(z\) a period contrast, and \(y\) the corresponding log-endpoint vector:
The columns are centered, and \(x'z=4\), so they are not orthogonal. Also \(x'x=4\), \(z'z=6\), and \(y'y=40\). The residual vector \(e=(1,-1,0,0)\) is orthogonal to both columns, and \(y=2x+z+e\), so the full-model residual sum of squares is \(e'e=2\).
Treatment entered first. The sequential sum of squares is the squared projection of \(y\) on \(x\): \(x'y=12\), so \(SS_{\text{treatment, first}}=(12)^2/4=36\). After adding period, the additional reduction is \(SS_{\text{period after treatment}}=2\).
Period entered first. Here \(z'y=14\), so \(SS_{\text{period, first}}=(14)^2/6=196/6=32.67\). Treatment added second accounts for the remaining explained sum of squares, \(SS_{\text{treatment after period}}=40-32.67-2=5.333\).
Thus the sequential treatment sum of squares is 36 when treatment enters first and 5.333 when period enters first. Neither calculation is an arithmetic error: they allocate shared variation differently. The nonzero residual sum of squares also shows that this example does not rely on a perfect fit.
Partial sums of squares and the specified contrast
A partial treatment test compares a reduced model without the treatment contrast to a full model that includes it, while retaining the other specified terms in both models. In a model with no treatment-by-period interaction, a treatment contrast might be defined as a common treatment difference adjusted for period. With an interaction, however, the treatment effect can differ by period; the analyst must specify whether to test the interaction, a treatment effect at a particular period, or a weighted average of period-specific effects.
The phrase “adjusted for period” describes the model comparison, not a guarantee that all possible targets of interest are the same. A contrast can average period-specific effects equally, weight them according to a target population, or evaluate the model at a specified period. Those are different estimands when effects vary across periods. In an unbalanced design, the observed marginal means implicitly use observed sample weights and may not represent the intended contrast.
Worked Example: Treatment Sum of Squares Adjusted for Period
Use the contrast-space data in the preceding example, now comparing the reduced model containing \(z\) with the full model containing \(z\) and \(x\). The partial treatment sum of squares is obtained by removing from \(x\) the part explained by \(z\), then measuring the remaining projection of \(y\).
Since \(y=2x+z+e\), with \(e\) orthogonal to both \(x\) and \(z\), the coefficient of the residualized treatment column is 2. Therefore the treatment sum of squares adjusted for period is \(2^2(4/3)=16/3=5.333\). Equivalently, the reduced-model residual sum of squares is \(2+16/3=22/3\), and subtracting the full-model residual sum of squares gives \(22/3-2=16/3\).
This is the treatment contribution after period has been accounted for, not the 36 attributed to treatment when it was entered first. In an actual crossover analysis, subject terms and the appropriate error model must also be included; this contrast-space calculation illustrates the sums-of-squares geometry, not a standalone clinical test.
Unbalanced cell means and the target treatment effect
A direct way to see how weighting affects interpretation is to inspect treatment means by period. The following hypothetical cell counts and log-endpoint means could arise when the two crossover sequences have unequal numbers of observed subjects. For illustration, suppose the intended model has a common treatment effect and no treatment-by-period interaction.
Worked Example: Observed Margins Versus an Equal-Period Contrast
Suppose the cell summaries are as follows. The entries are hypothetical log-endpoint means; counts are numbers of observed records.
| Period | Treatment | Count | Mean log endpoint |
|---|---|---|---|
| 1 | T | 4 | 12 |
| 1 | R | 1 | 10 |
| 2 | T | 1 | 14 |
| 2 | R | 4 | 14 |
The observed treatment margin is \((4(12)+1(14))/5=12.4\), while the observed reference margin is \((1(10)+4(14))/5=13.2\). Their difference is \(12.4-13.2=-0.8\) log units. This contrast gives substantial weight to period 2 for reference and period 1 for test because the cell counts differ.
The period-specific differences are \(12-10=2\) log units in period 1 and \(14-14=0\) in period 2. An equal-period contrast is \((2+0)/2=1\) log unit. In this particular table, fitting the common-effect additive model gives a treatment coefficient of 1: the period totals are both 5, and the adjusted treatment column yields that same equal-period comparison. The observed-margin difference of \(-0.8\) and the adjusted contrast of \(1\) answer different weighting questions.
The equal-period contrast is not automatically preferable in every application; its relevance depends on the scientific target. Nor does this table provide an inferential result by itself: subject-level dependence and residual variability must be handled in the crossover model.
Confounding, diagnostics, and common mistakes
Before interpreting any sums of squares, check that the design can estimate the requested effects. Imbalance can make columns correlated; more severe patterns can make them exactly linearly dependent. In the latter case, some coefficients or contrasts are not estimable. Software may drop a term, report a singular fit, or produce results that depend on coding choices. A numerical output is not evidence that the intended scientific comparison is identifiable.
For example, if only the TR sequence is observed in a two-period crossover, treatment and period are inseparable in the fixed-effects comparison. Code period as \(-1\) in period 1 and \(+1\) in period 2, and code treatment as \(+1\) for T and \(-1\) for R. In every observed TR subject, treatment is T in period 1 and R in period 2, so the treatment column is the negative of the period column. The data cannot distinguish a treatment difference from a period difference without additional assumptions. Adding a term order cannot resolve this rank deficiency.
Useful checks include reviewing sequence-by-period counts, checking the rank of the design matrix, confirming that the stated contrast is estimable, and comparing fitted-model specifications. If sums of squares or estimates change substantially with plausible adjustment choices, report that sensitivity rather than presenting one result as uniquely determined.
- Mistake: treating sequential sums of squares as order-free. In a nonorthogonal design, changing the entry order can change the variation assigned to a term. Report the order or use an explicitly defined model comparison.
- Mistake: assuming a partial test adjusts for every conceivable effect. It adjusts only for terms in the specified reduced and full models. Name those terms and state the contrast.
- Mistake: interpreting software’s “Type III” label without checking the hypothesis. Implementations and parameterizations can differ, especially with interactions or nonestimable contrasts. Inspect the actual linear hypothesis being tested.
- Mistake: using ordinary least-squares residual mean squares for correlated crossover records. Subject-level dependence affects the error model and inference. A sums-of-squares table does not substitute for the appropriate crossover model.
Sequential sums of squares are useful when the order has a substantive rationale, such as a prespecified sequence of model additions. Partial sums of squares are useful for isolating a term’s contribution conditional on a chosen adjustment set. Neither approach repairs poor overlap, confounding, a misspecified covariance structure, or an unclear estimand. For unbalanced mixed-effects analyses, the model-based estimation approach is a separate consideration.
Check Your Understanding
For each question, consider both the model comparison and the scientific interpretation. Solutions are included after each problem.
- A treatment term has sequential sum of squares 24 when entered first and 7 when entered after period. Is one necessarily incorrect? Solution: No. In a nonorthogonal design, the first value includes variation shared with period, while the second is the additional treatment variation after period is present.
- What must be stated to interpret a partial treatment sum of squares? Solution: State the full and reduced models, the other terms retained for adjustment, and the treatment contrast or contrasts tested. Also verify that the contrast is estimable.
- In an unbalanced study, why might the observed marginal treatment difference fail to match an adjusted treatment contrast? Solution: The observed margins weight period-specific means according to observed cell counts. An adjusted contrast may use different, explicitly chosen weights, such as equal weights across periods.
- If all observed subjects are in sequence TR, can treatment and period be separated in a two-period fixed-effects comparison? Solution: No. Under the stated coding, treatment equals the negative of period for every observed record, so the two columns are linearly dependent and their separate effects are not identifiable.
- Does a partial sum of squares by itself establish a valid crossover \(F\) test? Solution: No. The test also requires a suitable error and covariance model, an appropriate denominator and degrees of freedom, and the assumptions for the inferential procedure.