Factorial ANOVA and ANCOVA
IntermediateLesson 5 of 10 in Intermediate Statistics – Regression and ANOVA Course
What you will learn
- Describe designs that cross two or more independent factors, and split the variability of the outcome into main effects, an interaction and error.
- Describe a factorial design and its meansName the factors, levels and cells of a between-subjects factorial design, and calculate the cell, marginal and grand means.
- Partition the variability in a two-way ANOVASplit the total sum of squares into the parts explained by each factor, their interaction and error, and form the F ratios with their degrees of freedom.
- Describe a factorial design and its means
- Explain what main effects and interactions say about the means, read them from interaction plots, and break down an interaction with simple effects and follow-up comparisons.
- Explain main effects and interactionsDescribe main effects as differences between marginal means and interactions as effects that depend on another factor, and judge when a main effect is a fair summary.
- Draw and read interaction plotsPlot cell means as an interaction plot and read main effects and interactions from the pattern of the lines, without mistaking a picture for a test.
- Follow up with simple effects and post hoc testsBreak down a significant interaction with simple effects tests, and compare the levels of a main effect when there is no interaction to qualify it.
- Explain main effects and interactions
- Check that the model's assumptions are reasonable, express each effect as an effect size, and turn software output into a complete, correctly formatted report.
- Check the assumptions of a factorial ANOVACheck independence, normality of residuals and equal variances across cells, and know what to do when a check fails.
- Measure effect sizes in factorial designsCalculate and interpret eta squared, partial eta squared and omega squared for each effect, and express key differences in the units of the outcome.
- Read software output and report the resultsFind the needed values in ANOVA tables from different programs, and report a factorial ANOVA in APA style with its descriptive statistics and follow-up tests.
- Check the assumptions of a factorial ANOVA
- Explain why unequal cell sizes entangle the factors, distinguish weighted from unweighted means, and choose and report Type I, II or III sums of squares.
- Explain why unequal cell sizes change the analysisRecognize an unbalanced design, see how it makes the factors overlap, and compare weighted and unweighted marginal means.
- Choose between Type I, II and III sums of squaresCompute or read the three types of sums of squares, explain which hypothesis each one tests, and know the defaults of common statistics programs.
- Explain why unequal cell sizes change the analysis
- Use analysis of covariance to compare groups after accounting for a continuous covariate, check its extra assumptions, and interpret and report adjusted means.
- Explain what ANCOVA does and compute adjusted meansDescribe ANCOVA as a linear model with a factor and a covariate, explain its two purposes, and calculate and interpret adjusted group means.
- Check the assumptions specific to ANCOVACheck linearity, homogeneity of regression slopes, independence of the covariate from the treatment and covariate reliability, and know what a failed check means.
- Run, interpret and report an ANCOVARun an ANCOVA in common statistics programs, interpret the covariate and group effects, compare adjusted means, extend the model to factorial designs, and report it in APA style.
- Explain what ANCOVA does and compute adjusted means
Factorial ANOVA study guide
1Understand factorial designs and the two-way ANOVA model
A factorial design turns several separate comparisons into one study of combinations. Begin with who belongs in each cell and what the different means describe. Then build a two-way ANOVA by separating variation between cells from variation within them. The worked study of learning method and test timing connects each formula to a visible score pattern.
1.1 Describe the design and calculate its means
A factorial study asks about combinations. A factor is a categorical predictor, its levels are the categories, and a cell is one combination of levels. Crossing study method with test timing lets us ask whether the benefit of a method depends on when people are tested.
Count factors, levels, and cells
A 2 × 3 design has two factors and six cells. The two numbers name the factors' level counts; their product counts combinations. A 2 × 2 × 3 design has three factors and 12 cells. With three factors there are three main effects, three two-way interactions, and one three-way interaction. In general, k factors produce k main effects and effects altogether. Keeping the same number of people per cell becomes costly as factors are added.
Start with the cell means
Sixteen adults are randomly assigned to rereading or practice testing and to an immediate or delayed test. Four adults occupy each cell, so the design is balanced. Each adult contributes one score out of 20. The cell means are 16 and 9 for rereading at the immediate and delayed tests, and 17 and 15 for practice testing. These four means preserve the combinations that an overall average would hide.
A marginal mean averages over the other factor. With equal cell sizes, rereading has mean and practice testing has mean . Immediate testing averages ; delayed testing averages . The grand mean is the mean of all scores: . With unequal cell sizes, averaging the cell means and averaging all people's scores answer different questions.
Match the model to the people
This is a between-subjects design: each person belongs to exactly one cell and is measured once. If everyone took both tests, their paired scores would share personal influences. The error term would then need to represent repeated measurements. Counting those scores as independent observations would give the wrong uncertainty.
Random assignment to a manipulated factor supports a causal interpretation of its effect. A measured factor, such as experience group, supports an association because other differences may explain the pattern. Here the factors are fixed: the selected methods and times are the levels of interest. Randomly sampled schools would instead introduce a random factor.
Crossing factors also uses participants efficiently: every observation informs both factors. A factor that explains outcome variation can reduce error for the other tests, although it also uses degrees of freedom. Sensitivity improves when the reduction in error outweighs that cost.
Key Takeaways
- A design label gives level counts; multiplying them gives the number of cells.
- Cell means retain combinations; marginal means average over another factor.
- Plain averages of cell means equal observed marginal means in a balanced design.
- Independent observations come from the study design.
- Random assignment supports causal conclusions for manipulated factors.
1.2 Build the ANOVA table
Two-way ANOVA separates systematic differences between cells from the variation among people inside cells. It then separates the systematic part into factor A, factor B, and their interaction. Each effect receives its own test, using the same estimate of residual variation.
Write the model
The grand mean is . The terms and represent the two level effects. The interaction term is the cell's departure from the additive prediction, and the residual is the person's departure from the fitted cell mean. The three null hypotheses concern equal A marginal means, equal B marginal means, and no interaction.
Separate within-cell and between-cell variation
For the method × timing study, scores in the four cells are 14, 15, 17, 18; 6, 9, 10, 11; 15, 16, 18, 19; and 12, 14, 16, 18. Subtract each person's own cell mean and square the result. The cell totals are 10, 14, 10, and 20, giving . There are 16 scores and four estimated cell means, so and .
Between-cell variation uses the four cell means and grand mean 14.25: . Thus . Each squared difference receives weight 4 because four people share each cell mean.
Separate the effects
For a balanced design with a and b levels and n people per cell, and . Method gives 49 and timing gives 81. The remainder is interaction: . The method advantage changes from 1 to 6 points; its difference of differences is 5. In this 2 × 2 design, .
Divide by degrees of freedom
The effect degrees of freedom are , , and . Residual df is and total df is . Compute each , then . All three effects here have 1 df: method F = 10.89, timing F = 18.00, and interaction F = 5.56, each on (1, 12) df. Their p values are .006, .001, and .036.
Running separate one-way analyses changes the denominator: omitted effects enter the error. For method alone, error SS becomes 160 on 14 df, giving F = 4.29, p = .057. A regression with coded factors and their products fits the same full factorial model; the product terms carry the interaction.
Key Takeaways
- Total variation splits into model and residual variation.
- Balanced model variation splits into A, B, and A × B.
- Each effect has its own numerator df and shares the full-model residual denominator.
- A 2 × 2 interaction is a difference of differences.
- Separate one-way tests use a different error term.
- Factorial ANOVA is a linear regression model.
2Interpret main effects and interactions
The same average difference can hide very different patterns across conditions. Compare marginal means with effects at particular levels, and use interaction plots to see what changes. A significant interaction then leads to focused simple effects, with a correction for the family of follow-up tests. These tools let you explain where an effect is strongest and whether a single average is a useful description of the research result.
2.1 Explain what changes across conditions
A main effect summarizes an average difference. An interaction asks whether that difference changes across the other factor's levels. Keep those questions separate: significant main effects can occur without an interaction, and an interaction can occur without significant main effects.
Compare averages and conditional differences
In the study example, practice testing averages 16 and rereading averages 12.5. The method main effect is a 3.5-point difference averaged across timing. On the immediate test, the practice advantage is point. On the delayed test, it is points. Those unequal advantages describe the interaction. Equivalently, delaying the test lowers rereading by 7 points but practice testing by only 2. Either direction describes the same interaction.
Main effects and interactions are separate parts of the balanced model. “Both factors matter” is insufficient to establish interaction: two fixed additive differences would produce main effects and no interaction. Nor does interaction mean the factors themselves are correlated. It concerns the outcome pattern across their combinations.
Recognize an order reversal
An ordinal interaction keeps the order of levels while changing the size of the difference. Practice testing stays above rereading at both times. A crossover interaction reverses the order. Consider task × music means: reading scores are 80, 76, and 66 with no, calm, and upbeat music; sorting scores are 70, 74, and 80. Reading leads with no or calm music, but sorting leads with upbeat music.
The music marginal means are 75, 75, and 73. That small average change hides substantial and opposite changes within the tasks. The statement “upbeat music lowers performance” would therefore miss the sorting result. Name the factor and conditions when describing an ordinal or crossover pattern; reversing the plotting roles can change whether the displayed lines cross.
Let the interaction guide the conclusion
Read the highest-order effect first. A significant method × timing interaction makes the conditional method differences central. Its main effect remains a valid average, but that average blends a small immediate advantage with a larger delayed advantage. With a crossover, the average can match none of the conditions. Simple effects express the differences at particular levels.
Interaction also depends on the outcome scale. A logarithmic transformation can change or remove an ordinal pattern by changing relative distances. A strictly monotonic rescaling of the displayed means preserves their order, so it preserves an order reversal. Transforming individual observations and then recomputing arithmetic means is a different operation.
With three factors, a three-way interaction means a two-way interaction changes across the third factor. If method × timing is strong among younger adults but absent among older adults, compare those two-way patterns within age groups. A three-way finding qualifies the lower-order effects it contains.
Key Takeaways
- Main effects compare marginal means; interactions compare effects across conditions.
- An interaction can exist without either main effect.
- Ordinal patterns preserve an order; crossover patterns reverse it.
- Interpret the highest-order interaction before averaging its factors.
- A three-way interaction is a change in a two-way interaction.
2.2 Read the pattern in an interaction plot
An interaction plot shows cell means in a form that makes changing differences visible. Put one factor on the horizontal axis and draw one line for every level of the other factor. Label the vertical axis with the outcome and its unit, so the size of a gap has a clear meaning.
Draw the study pattern
Place immediate and delayed testing on the horizontal axis. Mark rereading at 16 and 9 and connect its points; mark practice testing at 17 and 15 and connect those. The rereading line falls by 7, while the practice line falls by 2. Unequal changes make the lines nonparallel. They do not cross in this view: practice testing stays higher and the gap grows toward the delayed test.
To read the method main effect, average each line's heights: 12.5 for rereading and 16 for practice. To read the timing main effect, average vertically at each position: 16.5 immediately and 12 after a week. A slope in one line alone describes a timing effect for that method; it is the average profile that describes the timing main effect.
Distinguish three patterns
Parallel profiles have equal changes, so the sample has no interaction. Nonparallel profiles show changing differences. Crossing profiles display an order reversal for the line factor. In the task × music example, the reading line falls from 80 through 76 to 66 and the sorting line rises from 70 through 74 to 80. Their crossover shows that the task ranking changes with music.
You can exchange the axis and line factors without changing the underlying data or interaction test. The appearance changes, however: crossing in one arrangement need not mean crossing in the other. Choose the arrangement that makes the research question easiest to follow, often putting the factor with more levels on the horizontal axis.
Connect the picture to uncertainty
Sample means fluctuate. Slight nonparallelism is common even when the population has no interaction. Use the interaction F test to judge the evidence, and use the plot to describe the pattern. Small cells can make a striking pattern uncertain; large cells can make a subtle pattern detectable. Error bars help when their label says whether they show standard errors or confidence intervals.
Overlapping 95% confidence intervals around two means are insufficient to decide their comparison, and they do not test an interaction. The uncertainty of a difference depends on how that difference is estimated. Read the relevant test or confidence interval for the contrast itself.
Lines connect categories to guide the eye; a point between “rereading” and “practice testing” has no defined treatment meaning. A clustered bar chart carries the same cell means. A narrow vertical range exaggerates visual differences, so read the numbers as well as the shape. Software may call these profile, means, estimated marginal means, or descriptive plots; R also provides interaction.plot() and emmeans::emmip().
Key Takeaways
- Nonparallel lines show changing sample differences.
- Average line heights and average profiles show different main effects.
- Switching plotting roles preserves the statistical interaction.
- The interaction test supplies evidence about the population.
- Error bars and axis ranges need explicit labels.
2.3 Choose and test the follow-up comparisons
A significant interaction tells you that effects vary, but it does not identify every important comparison. Simple effects hold one factor fixed and test the other. Choose the direction from the research question: comparing methods at each time answers a different practical question from comparing times within each method.
Use the full model's error
In the delayed-test cells, the means are 9 and 15, with four people each. Their average is 12, so . With two methods, numerator df is 1. Divide by the full-model residual MS of 4.5: , p = .002. The pooled denominator uses all four cells and assumes equal cell variances.
For immediate testing, the means are 16 and 17 and their average is 16.5. Now , giving , p = .518. There is strong evidence of a delayed advantage, while the immediate comparison is inconclusive. Failure to detect the immediate difference does not establish equal population means.
Define the family of tests
Each added test raises the chance of a false positive somewhere in the family. Bonferroni compares each of m p values with . For these two simple effects, use .025 at an overall .05 level. The delayed effect passes; the immediate effect does not. Equivalent Bonferroni-adjusted p values multiply each unadjusted p by two, capped at 1.
The contrast between “significant” and “not significant” is not a test of the difference between effects. That difference needs the interaction test or an interaction contrast. A planned interaction contrast tests a specific difference of differences with 1 df, such as whether upbeat versus no music has a different effect on reading and sorting.
Match further tests to the finding
With three or more levels, a significant simple effect only establishes that some means differ within that condition. Follow it with selected comparisons and a correction such as Holm or Bonferroni. If no interaction qualifies a significant main effect, use pairwise comparisons of its marginal means; a two-level main effect already identifies its only pair. Tukey comparisons suit all pairwise comparisons in one such family.
In SPSS, request comparisons of estimated marginal means within timing; in jamovi, GAMLj offers simple-effects tools; JASP also offers simple-effects analysis. In R, use pairs(emmeans(model, ~ method | timing)). These are separate families by timing unless combined. To adjust the two method tests together, use test(pairs(emmeans(model, ~ method | timing)), by = NULL, adjust = "bonferroni"). A within-condition correction alone leaves each one-comparison family unchanged.
Key Takeaways
- Simple effects compare levels while holding another factor fixed.
- Use the full-model pooled error when cell variances are equal.
- Define the multiplicity family before interpreting p values.
- Different significance decisions do not test a difference of effects.
- Follow-ups must compare the means that answer the research question.
- A software correction within each condition may leave the across-condition family unadjusted.
3Check, measure and report a factorial ANOVA
A result is useful only when the model fits the study and its magnitude is clear. Check how observations were collected, inspect residuals and cell variances, and investigate unusual scores. Then choose an effect-size denominator and connect the numerical tests to the means. Reading equivalent software output prepares you to write a report that explains both the evidence and the size of the differences, including inconclusive results.
3.1 Check the model against the data
Assumption checks ask whether the model represents how the scores were produced and how their remaining variation behaves. The outcome is continuous. Observations must be independent, residuals approximately normal within cells, and population variances equal across cells.
Start with the design
Independence concerns relationships between observations. Each person supplies one score without influencing another person's score. Repeated observations on one person and clusters such as couples or classrooms share influences. A residual plot cannot repair or confirm independence; use the study design to identify the dependence and choose a repeated-measures or multilevel model that represents it.
Inspect residuals, not the pooled outcome
For a full factorial model, each residual is a score minus its cell mean. A Q–Q plot compares ordered residuals with a normal pattern; a histogram reveals skew and unusual tails. Pooled scores can have two peaks simply because treatments have different means. That pattern alone says little about normality inside the cells.
Shapiro–Wilk and similar tests need context. Large samples can detect tiny departures, while small samples can miss major ones. Look for meaningful problems such as a ceiling in a bounded score, heavy tails, or isolated extremes. Moderate non-normality is often tolerable with adequate cell sizes, especially in balanced designs.
Compare all cell variances
Homogeneity concerns every factor combination, not just the two broad method groups. The study's four variances are 3.33, 4.67, 3.33, and 6.67. The largest is twice the smallest. Levene's test gives F(3, 12) = 0.27, p = .84, providing no evidence of unequal variances. Combine this with the cell sizes and plots; a large p value leaves room for differences that a small sample misses.
Unequal variance becomes more troublesome with unequal cell sizes. Small cells with large variances tend to make the usual F tests reject too often; large cells with large variances tend to make them conservative. Compare the size–variance pairing before treating a single variance ratio as the whole diagnosis.
Investigate unusual scores and choose a response
Standardized residuals beyond about ±3 deserve inspection. Correct a transcription error using the original record. A genuine extreme value stays unless a pre-stated exclusion rule applies. Report removals and compare results with and without them, because one score may influence both a mean and the pooled error.
A log transformation can help positive, right-skewed outcomes, but changes the scale on which effects and interactions are interpreted. Robust methods based on trimmed means or bootstrapping can reduce sensitivity to particular departures; R's WRS2 provides such methods. HC3 standard errors address unequal variance for model parameters. Describe the method and reason, then check whether the substantive pattern survives the change.
Key Takeaways
- Independence is a design question.
- Normality concerns residuals within cells.
- Variance checks must include every cell.
- Unequal variances are especially risky when cell sizes differ.
- Investigate outliers before deciding how to handle them.
- Report the chosen remedy and its effect on interpretation.
3.2 Separate statistical evidence from effect size
An F test assesses evidence against a null hypothesis; an effect size describes the magnitude of a pattern. Report both. A small p value does not tell a reader whether a difference is useful, and a large sample can make a small difference precise.
Choose the denominator deliberately
Eta squared uses all corrected outcome variation: . For method, . Partial eta squared uses only the effect plus residual variation: . Method therefore gives . The larger value follows from the smaller denominator; it is not a second estimate of the same share of total variation.
Timing has eta squared .39 and partial eta squared .60. Interaction has eta squared .12 and partial eta squared .32. In a one-way design these definitions coincide because there are no other effects. In a factorial design, other explained variation makes the partial denominator smaller than the total.
Know what can be added
In the balanced study, the eta squared values sum to , the model's R squared. The same additive accounting works for sequential Type I sums of squares in an unbalanced design. Type II and III effect sums of squares in an unbalanced design overlap, so their eta squared values can sum above or below R squared.
Partial eta squared values have different denominators. Their sum here is about 1.40, which has no useful variance-partition meaning. An interaction partial eta squared of .32 says the interaction accounts for 32% of interaction-plus-residual SS, not 32% of every score's total variability. Additional factors can change residual variation, so comparisons across studies with different designs need care.
Allow for upward bias
Sample eta squared estimates tend to overestimate population magnitude, especially in small samples. Partial omega squared applies a bias correction: . The study interaction gives , below partial eta squared .32. Report a negative estimate as zero.
Return to the outcome's units
Practice testing improves the delayed mean by 6 points out of 20. Dividing by the pooled within-cell SD gives . The raw difference makes the scale clear; the standardized difference expresses it relative to within-cell variation. These small teaching data produce an unusually large difference.
Rough eta squared conventions call .01 small, .06 medium, and .14 large. Use comparable studies and the consequences of a score change when possible. A magnitude label alone leaves the reader without the practical meaning of the outcome.
Key Takeaways
- Eta squared uses total SS; partial eta squared uses effect plus residual SS.
- Partial effect sizes do not form an additive partition.
- Omega squared corrects upward sample bias.
- Raw differences retain the outcome scale.
3.3 Turn software rows into a results report
ANOVA programs arrange the same ingredients differently. First identify the model terms and residual row, then read numerator df, F, p, and effect size together. A results report must explain the pattern of means as well as the tests.
Find the matching rows
In SPSS, “Tests of Between-Subjects Effects” lists method, timing, method × timing, and Error. The “Sig.” column contains p values. jamovi and JASP use effect rows and a Residuals row. R's summary(aov(score ~ method * timing, data = d)) labels columns Df, Sum Sq, Mean Sq, F value, and Pr(>F). The formula's * includes both main effects and their interaction.
The balanced study gives the same effect tests across these programs: method SS 49, F 10.89, p .006; timing SS 81, F 18.00, p .001; interaction SS 25, F 5.56, p .036. Each numerator has 1 df. Error SS is 54 on 12 df, giving MS 4.5. Request partial eta squared to obtain .48, .60, and .32. For unequal cell sizes, check the sums-of-squares setting before comparing tables.
| Quantity | SPSS | jamovi / JASP | R |
|---|---|---|---|
| Error variation | Error | Residuals | Residuals |
| Significance probability | Sig. | p | Pr(>F) |
| Method test | F = 10.89, p = .006 | F = 10.89, p = .006 | F value = 10.89, Pr(>F) = .006 |
| Timing test | F = 18.00, p = .001 | F = 18.00, p = .001 | F value = 18.00, Pr(>F) = .001 |
| Interaction test | F = 5.56, p = .036 | F = 5.56, p = .036 | F value = 5.56, Pr(>F) = .036 |
Separate SPSS totals
“Corrected Model” tests the complete set of effects: SS 155 on 3 df, F = 11.48, p < .001. “Corrected Total” is total squared deviation from the grand mean: 209 on 15 df. “Total” is the uncorrected sum of squared scores, 3458 on 16 df. Use Corrected Total for eta squared. The Intercept tests a zero grand mean and usually does not answer the research question. Model R squared is 155/209 = .742.
Describe the interaction first
The design is a 2 × 2 between-subjects factorial ANOVA with four people per cell. Report cell means and SDs: rereading–immediate 16.00 (1.83), rereading–delayed 9.00 (2.16), practice–immediate 17.00 (1.83), and practice–delayed 15.00 (2.58). Include assumption checks and an interaction plot so readers can connect the tests with the data.
A test sentence is: “The method × timing interaction was significant, F(1, 12) = 5.56, p = .036, partial η² = .32.” Explain that the practice advantage was larger after a delay. Report the simple effects and the Bonferroni threshold .025: delayed F = 16.00, p = .002; immediate F = 0.44, p = .518. The nonsignificant immediate result leaves its magnitude uncertain.
Complete the statistical record
Report both main effects too, while explaining that the interaction qualifies their averages. Use exact p values to two or three decimals; change software's “.000” to p < .001. Omit the leading zero for p and eta squared, which cannot exceed 1. Include effect sizes and confidence intervals where available, including for nonsignificant effects. A nonsignificant test is a finding about evidence, not a demonstration of zero effect.
Key Takeaways
- Match effect rows across programs before comparing results.
- Use Corrected Total for total variation around the mean.
- Report the design, cell sizes, descriptive statistics, checks, and all effects.
- Explain the interaction and corrected follow-ups.
- Write p < .001 when software displays .000.
4Analyze unbalanced designs and choose the type of sums of squares
Unequal cell sizes change the mix of people behind a group average. A training group with many experienced employees can score higher partly because of its composition. Compare weighted and equally weighted means before choosing a test. The different sums-of-squares types assign shared variation in different ways, so matching the test to the research question is essential when software tables disagree.
4.1 Choose how to average unequal cells
Unequal cell sizes change what an overall group comparison represents. In a balanced design, factors are orthogonal: knowing a person's level of one factor tells you nothing about their allocation to the other. Imbalance can make the factors associated, so their explanations of the outcome overlap.
Read the sample composition
Sixteen employees take a skills test. Without training, six juniors average 10 and three seniors average 20. With a course, two juniors average 14 and five seniors average 26. Seniors make up five of seven course takers but only three of nine employees without training. Comparing training groups also partly compares experience groups.
The course advantage is 4 points among juniors and 6 among seniors. These conditional comparisons hold experience fixed. Neither equals the 9.24-point difference between the raw training-group averages, because the course group includes a higher proportion of the stronger-scoring seniors.
Calculate both kinds of marginal mean
A weighted marginal mean weights each cell mean by its number of people. Without training it is . With training it is . Their difference describes these particular groups as recruited, including their different experience mixes.
An unweighted marginal mean gives each experience level equal weight. Without training it is and with training it is . The resulting 5-point difference averages the junior and senior advantages equally. Equal weighting answers a question about an equal mix of experience levels, even though the observed sample has a different mix.
Report model-based means clearly
Estimated marginal means, or least-squares means, come from the fitted model. For the full factorial model with all cells observed and equal weighting across factor levels, they are these unweighted cell averages. Request equal weights explicitly when software offers observed-frequency weights too. Report which means are shown; labeling a raw weighted mean as adjusted hides the comparison being made.
Decide how to test shared variation
When factors overlap, their main-effect sums of squares depend on which other terms they adjust for. Type I assigns shared variation sequentially; Type II and III use different adjusted hypotheses. Type I still partitions the model SS in its stated order. Type II and III effect sums of squares generally do not add to model SS.
Deleting participants just to equalize cells discards information. Keep the data and make the weighting and test choices explicit. If imbalance arose because a treatment caused dropout, changing sums of squares cannot remove the selection problem; describe that loss. Also compare each cell's variance with its size: high variance in small cells makes the usual pooled-error test especially vulnerable.
Key Takeaways
- Weighted means describe the observed mix of people.
- Unweighted means give each other-factor level equal influence.
- Estimated marginal means require an explicit weighting choice.
- Imbalance creates shared explained variation.
- Deleting data does not solve the interpretation of imbalance.
4.2 Choose the hypothesis behind the sum of squares
A sums-of-squares type specifies how to assign variation shared by predictors. Choose it from the research question and the model, then report it. A program's default can otherwise change the question without changing the labels printed beside its rows.
Type I follows an order
Type I, or sequential SS, measures what each term adds after earlier terms. In the training study, entering training first gives SS 336.0; entering it after experience gives SS 88.2. The first test includes the variation training shares with experience, while the second adjusts for experience. These are different hypotheses about the same data. The sequential sums always add to model SS in their chosen order.
A deliberate sequence makes sense when testing improvement beyond a prior control term. State the order. Rearranging the formula merely to obtain a smaller p value abandons that interpretation. With interactions entered last, their SS compares the full model against the additive main-effects model.
Type II respects the main-effect hierarchy
Type II tests each main effect after the other main effects, without adjusting it for interactions that contain it. Training SS is 88.2, experience SS 402.4, and interaction SS 3.3. This is useful when the interaction is negligible and an additive description is appropriate. Its main-effect tests are more powerful when the no-interaction assumption holds. A strong interaction calls for interpreting conditional differences instead of treating an averaged main effect as the whole finding.
Type III tests averaged main effects in the full model
Type III tests each effect while accounting for the other effects. For a complete factorial design with suitable contrasts, main effects compare equally weighted marginal means. Training SS is 83.3, experience SS 403.3, and interaction SS 3.3. Their sum, about 490.0, is not model SS 741.75. Overlap between adjusted hypotheses prevents a single additive partition.
The full-model residual stays SS 24 on 12 df, so residual MS is 2. Training's F is 168.0 with Type I entered first, 44.1 with Type II, and 41.7 with Type III. The interaction has F(1, 12) = 1.67, p = .22 for all three types when entered last in Type I. Balanced data make the three approaches agree.
Align software and contrasts
SPSS GLM Univariate, jamovi, and JASP commonly default to Type III; check the selected option. R's aov() and anova() give sequential tests, whereas car::Anova() defaults to Type II. For Type III averaged main effects with interactions in R, set options(contrasts = c("contr.sum", "contr.poly")) before fitting, then call car::Anova(model, type = 3). Treatment coding can instead make a Type III factor test refer to the other factor's reference level. Requesting Type III after fitting is insufficient to change those codes.
Key Takeaways
- Type I assigns shared variation in entry order.
- Type II main effects adjust for other main effects.
- Type III averaged main effects need suitable contrast coding.
- The highest-order interaction and full-model residual agree across types.
- Always state the test type and any deliberate order.
5Adjust group comparisons for a covariate with ANCOVA
A continuous baseline measure can help explain why people finish with different scores. ANCOVA uses that information to compare groups at a shared starting point. Work through the adjusted means, then check whether a common linear adjustment fits every group. Finally, read the covariate and group tests together and compare the fitted means. The same reasoning extends to studies that cross several factors while adjusting for prior knowledge.
5.1 Adjust the comparison to a common starting point
ANCOVA combines categorical factors with a continuous predictor called a covariate. A pretest can explain outcome variation that group membership does not explain. It can also adjust group comparisons when groups began with different pretest means.
Add a continuous predictor
With one factor, the model is . The group terms encode categorical differences; the slope links the covariate to the outcome within groups. ANCOVA compares groups at a shared covariate value. It models the posttest using the pretest, which is different from automatically subtracting pretest from posttest for each person.
Fifteen adults are randomly assigned to control, a learning app, or a tutor, five per group. Their pretest means are 27, 28, and 34 and posttest means are 31.6, 36.0, and 42.2 out of 50. The tutor group began higher, so its raw posttest advantage combines a treatment comparison with a starting-score difference.
Calculate adjusted means
At the overall pretest mean 29.67, an adjusted group mean is . The pooled within-group slope is 0.745. For control, . For the app, . For tutoring, , rounded from the unrounded model quantities.
A positive slope moves above-average starters down and below-average starters up. A negative slope reverses those directions; a zero slope leaves means unchanged. The adjusted mean predicts performance at the common starting score. It does not change anyone's observed result or make every person in a group identical.
Separate precision from adjustment
Tutor–control is 10.6 points before adjustment and about 5.39 after adjustment using unrounded fitted means. Meanwhile, error MS falls from 16.83 on 12 df to 4.56 on 11 df. The covariate explains within-group variation but costs one residual df. The group F falls from 8.42 to 6.35: reducing error need not strengthen the group test when the adjusted group differences also shrink.
Choose useful covariates in advance
A pre-treatment measure with a clear expected relationship to the outcome can improve the analysis. Many covariates consume degrees of freedom, and trying alternatives until one produces a desired result increases false positives. Choose them for substantive reasons before inspecting group p values.
Adjustment covers the covariates and relationships in the fitted model. Random assignment supports a causal treatment interpretation; with intact groups, adjusted differences remain associations. A common pretest value must also represent a meaningful comparison for the groups, because prediction far outside their observed covariate ranges relies on extrapolation.
Key Takeaways
- ANCOVA combines factors with continuous covariates.
- Adjusted means predict groups at a common covariate value.
- The within-group slope sets the size and direction of adjustment.
- A lower error MS does not guarantee a larger group F.
- Select pre-treatment covariates before inspecting results.
5.2 Check whether a common adjustment fits
A common-slope ANCOVA uses the same linear adjustment in every group. Along with ANOVA's residual assumptions, it needs linear covariate relationships, equal regression slopes, a covariate unaffected by treatment, and reliable covariate measurement.
Plot the relationship within groups
Draw posttest against pretest, distinguishing the groups and fitting a line in each. Check whether a straight line follows each cloud of points. A pooled correlation can be high because the group centers differ even if the within-group relationships are weak. For adjustment, it is the within-group relationship that matters.
Curvature means a straight-line adjustment misses systematic variation. Consider a squared covariate term or a meaningful transformation, then examine whether the revised model fits. Also inspect overlap: adjusted comparisons at values observed in each group are easier to interpret than predictions far beyond a group's observed range.
Test whether slopes differ
Fit a model containing group × covariate. In the learning example, slopes are 0.69, 0.90, and 0.67 for control, app, and tutor. The slope-interaction test is F(2, 9) = 0.26, p = .77. Together with the plots, this supports using a common slope for these data; the slopes need not be numerically identical in the sample.
If slopes clearly differ, group differences vary across the covariate. Retain the interaction and describe differences at chosen covariate values. This is moderation. Centering the covariate at its mean makes a factor test in that interacting model refer to that mean, while another center would shift its reference point. A single adjusted difference would hide the changing comparison.
Keep the covariate before the treatment
A baseline score is measured before assignment can affect it. Study time during an intervention can be changed by the intervention itself. Adjusting for that time could remove a pathway through which the treatment works and change the meaning of the group comparison. Timing and subject knowledge guide this choice.
A baseline-difference p value is not a covariate-selection rule. In a randomized study, starting differences arise by chance. The example's pretest ANOVA has p = .080, but that does not decide whether the pretest belongs in the planned outcome model. Its predictive value and the analysis plan do.
Examine reliability and the adjusted residuals
Measurement error in the covariate weakens adjustment, leaving part of an initial difference in place. With nonrandom groups, ANCOVA and analysis of change scores can disagree because they answer different questions under different starting conditions; this is the issue called Lord's paradox. After choosing the covariate model, inspect residual normality, variances, and outliers again. An acceptable slope check does not replace those checks or establish independence.
Key Takeaways
- Inspect covariate relationships within every group.
- Test common slopes with group × covariate.
- Retain differing slopes and describe conditional group differences.
- Avoid adjusting for a treatment consequence.
- Baseline significance tests do not select covariates.
- Unreliable covariates leave incomplete adjustment.
5.3 Fit and report the adjusted model
An ANCOVA table separates the covariate test from the adjusted group test. The group row answers whether modeled group means differ at the same covariate value. Follow-up comparisons must use those adjusted means too.
Fit comparable models in common programs
In SPSS, choose Analyze > General Linear Model > Univariate, place posttest as the dependent variable, group as a fixed factor, and pretest as a covariate. Request estimated marginal means and Bonferroni comparisons. In jamovi or JASP, use ANCOVA with the same variable roles and check the terms, SS type, and covariate reference value. Request descriptive statistics and diagnostic plots alongside the tests.
In R, set sum-to-zero factor contrasts before fitting if using Type III tests. Fit model <- lm(post ~ pre + group, data = d), obtain car::Anova(model, type = 3), and compare emmeans::emmeans(model, pairwise ~ group, adjust = "bonferroni"). The common-slope fit follows the earlier model with group × pre used to check slopes.
Read the adjusted tests
The learning example has pretest SS 151.88 on 1 df, F = 33.34, p < .001, partial eta squared .75. Group SS is 57.83 on 2 df, F = 6.35, p = .015, partial eta squared .54. Residual SS is 50.12 on 11 df, MS = 4.56. The pretest slope 0.745 means one additional pretest point predicts about 0.75 additional posttest points within a group.
The group F tests adjusted means, not raw means. With sequential tests, aov(post ~ group + pre, data = d) gives group SS 283.6 before adjusting for pretest. Putting pre first gives adjusted group SS 57.83. Type II or III tests also give that adjusted group SS in this additive model, without depending on entry order.
Compare fitted means and state the finding
Bonferroni comparisons give tutor–control 5.39 points, p = .021; app–control 3.66, p = .062; tutor–app 1.73, p = .87. Differences use unrounded estimates, so subtracting printed means can differ slightly. Comparing the raw means with a separate post hoc test would lose the covariate adjustment.
A report can say: “After adjustment for pretest, the conditions differed in posttest scores, F(2, 11) = 6.35, p = .015, partial η² = .54. Bonferroni comparisons showed higher adjusted scores with tutoring than control, p = .021.” Add the other comparisons, covariate test, raw and adjusted means, adjustment value 29.67, SS type, and assumption checks, including the slopes test.
Extend to crossed factors
Factorial ANCOVA combines factors and their interactions with covariates, such as method × timing plus prior knowledge. Interpret main effects and interactions on adjusted cell means. Check slope homogeneity across all cells and choose SS types deliberately when cells are unequal. Simple effects then hold another factor fixed while retaining the covariate adjustment.
Key Takeaways
- The group row tests adjusted means.
- Sequential group tests adjust only for terms entered earlier.
- Compare estimated marginal means after ANCOVA.
- Report the covariate reference value and slope checks.
- Factorial ANCOVA interprets interactions on adjusted cell means.
Factorial ANOVA examples
1Understand factorial designs and the two-way ANOVA model
14 steps
- 1IntroductionStart with the research question
A factorial design turns several separate comparisons into one study of combinations. Begin with who belongs in each cell and what the different means describe. Then build a two-way ANOVA by separating variation between cells from variation within them. The worked study of learning method and test timing connects each formula to a visible score pattern.
- 2ExplanationCross the factors
A factorial study asks about combinations. A factor is a categorical predictor, its levels are the categories, and a cell is one combination of levels. Crossing study method with test timing lets us ask whether the benefit of a method depends on when people are tested.
- 3ExplanationCount the combinations
A 2 × 3 design has two factors and six cells. The two numbers name the factors' level counts; their product counts combinations. A 2 × 2 × 3 design has three factors and 12 cells. With three factors there are three main effects, three two-way interactions, and one three-way interaction. In general, k factors produce k main effects and effects altogether. Keeping the same number of people per cell becomes costly as factors are added.
- 4ExplanationPlace the learners in cells
Sixteen adults are randomly assigned to rereading or practice testing and to an immediate or delayed test. Four adults occupy each cell, so the design is balanced. Each adult contributes one score out of 20. The cell means are 16 and 9 for rereading at the immediate and delayed tests, and 17 and 15 for practice testing. These four means preserve the combinations that an overall average would hide.
- 5ExampleCalculate the marginal means
A marginal mean averages over the other factor. With equal cell sizes, rereading has mean and practice testing has mean . Immediate testing averages ; delayed testing averages . The grand mean is the mean of all scores: . With unequal cell sizes, averaging the cell means and averaging all people's scores answer different questions.
- 6TipCheck who was measured
This is a between-subjects design: each person belongs to exactly one cell and is measured once. If everyone took both tests, their paired scores would share personal influences. The error term would then need to represent repeated measurements. Counting those scores as independent observations would give the wrong uncertainty.
- 7ChallengeCount people and averages
A 2 × 3 design assigns five independent adults to every cell. How many adults are needed, and can a row’s observed marginal mean be calculated by plainly averaging its cell means?
---reveal---
There are six cells, so 30 adults are needed. Equal cell sizes make the plain cell average valid. If cell sizes differed, an observed row mean would weight the cells by their sample sizes.
- 8ExplanationWrite the model
The grand mean is . The terms and represent the two level effects. The interaction term is the cell's departure from the additive prediction, and the residual is the person's departure from the fitted cell mean. The three null hypotheses concern equal A marginal means, equal B marginal means, and no interaction.
- 9ExampleCalculate residual variation
For the method × timing study, scores in the four cells are 14, 15, 17, 18; 6, 9, 10, 11; 15, 16, 18, 19; and 12, 14, 16, 18. Subtract each person's own cell mean and square the result. The cell totals are 10, 14, 10, and 20, giving . There are 16 scores and four estimated cell means, so and .
- 10ExampleCalculate between-cell variation
Between-cell variation uses the four cell means and grand mean 14.25: . Thus . Each squared difference receives weight 4 because four people share each cell mean.
- 11ExampleSeparate the three effects
For a balanced design with a and b levels and n people per cell, and . Method gives 49 and timing gives 81. The remainder is interaction: . The method advantage changes from 1 to 6 points; its difference of differences is 5. In this 2 × 2 design, .
- 12ExampleBuild the F tests
The effect degrees of freedom are , , and . Residual df is and total df is . Compute each , then . All three effects here have 1 df: method F = 10.89, timing F = 18.00, and interaction F = 5.56, each on (1, 12) df. Their p values are .006, .001, and .036.
- 13ChallengeConnect the partition to the test
A balanced 2 × 2 study has model SS 90, A SS 20, B SS 40, residual SS 60, and N = 24. Find the interaction F and state its df.
---reveal---
Interaction SS is 90 − 20 − 40 = 30 on 1 df. Residual df is 24 − 4 = 20, giving residual MS 3. Thus F(1, 20) = 10. The interaction test compares changing cell differences with within-cell noise.
- 14RecapConnect the decisions
Start from the factor combinations and cell sizes. Cell means lead to marginal means; the balanced model then splits variation into two main effects, interaction, and residual. Every effect F uses the full-model residual MS. Before interpreting its p value, check that its numerator and error degrees of freedom match the design.
2Interpret main effects and interactions
20 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionStart with the research question
- 2ExplanationCompare the conditional advantages
- 3ExplanationSpot an order reversal
- 4ExplanationSee why an average can hide an effect
- 5ExplanationLead with the interaction
- 6ExplanationExtend the idea to three factors
- 7ChallengeExplain a hidden main effect
- 8ExplanationChoose the axes and lines
- 9ExamplePlot the learning study
- 10ExplanationRead each main effect
- 11ExplanationCompare parallel and crossing profiles
- 12ExplanationSeparate a pattern from evidence
- 13ChallengeRead without overclaiming
- 14ExplanationChoose the comparison
- 15ExampleWork the delayed simple effect
- 16ExampleWork the immediate simple effect
- 17ExplanationProtect the test family
- 18ExplanationCombine software test families
- 19ChallengeJudge the whole interaction claim
- 20RecapConnect the decisions
3Check, measure and report a factorial ANOVA
18 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionStart with the research question
- 2TipCheck the observation design
- 3ExplanationExamine within-cell residuals
- 4ExplanationCompare cell variances
- 5ExplanationPair cell sizes with variances
- 6ExplanationInvestigate an unusual score
- 7ChallengeChoose the important diagnostic
- 8ExplanationChoose the effect-size denominator
- 9ExplanationInterpret a partial proportion
- 10ExplanationCorrect sample bias
- 11ExplanationReturn to score units
- 12ChallengeInterpret two denominators
- 13ExplanationMatch the output labels
- 14ExplanationDistinguish the SPSS totals
- 15ExplanationGive the descriptive statistics
- 16ExplanationWrite the interaction result
- 17ChallengeChoose the report’s total
- 18RecapConnect the decisions
4Analyze unbalanced designs and choose the type of sums of squares
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionStart with the research question
- 2ExplanationRead the experience mix
- 3ExampleCompute the observed weighted means
- 4ExampleCompute equal-cell means
- 5ExplanationSpecify the model-based weighting
- 6ChallengeCompare the two averages
- 7ExplanationEnter terms sequentially
- 8ExplanationTest main effects with Type II
- 9ExplanationTest equal-cell averages with Type III
- 10ExplanationKeep the same residual denominator
- 11ExplanationFit suitable contrasts in R
- 12ChallengeMatch means with a test
- 13RecapConnect the decisions
5Adjust group comparisons for a covariate with ANCOVA
21 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionStart with the research question
- 2ExplanationAdd the continuous predictor
- 3ExampleRead the starting means
- 4ExampleCalculate adjusted outcomes
- 5ExplanationFollow the slope’s sign
- 6ExplanationCompare numerator and error changes
- 7ChallengeWork an adjustment with its sign
- 8ExplanationLook within groups
- 9ExplanationTest the common slope
- 10ExplanationKeep a slope interaction
- 11TipAvoid a treatment consequence
- 12TipCheck measurement quality
- 13ChallengeExplain a changing group difference
- 14ExplanationAssign the variable roles
- 15ExplanationFit the adjusted model in R
- 16ExplanationRead the covariate and group rows
- 17TipCheck the sequential order
- 18ExplanationCompare the fitted means
- 19ExplanationExtend to factorial ANCOVA
- 20ChallengeConnect model, slopes, and follow-up
- 21RecapConnect the decisions
Factorial ANOVA practice questions
Set 1: Designs, interactions, and follow-ups10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Diagnostics, effect sizes, and unequal cells10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
car::Anova(model, type = 3). One tests a factor at the other factor’s reference level; the other tests its equal-cell average effect. What most directly explains this?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Choose an analysis and defend the conclusion10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Adjusted group test
Adjusted mean
Adjusted pairwise comparison
ANCOVA
B
Balanced design
Bonferroni correction
C
Cell
Cell standard deviation
Corrected Model
Corrected Total
Covariate
Covariate reference value
Covariate reliability
Crossover interaction
D
Degrees of freedom
E
Error bar
Estimated marginal mean
Eta squared
Exact p value
F
F ratio
Factor
Factorial ANCOVA
Fixed factor
G
Grand mean
H
HC3 standard errors
Homogeneity of regression slopes
Homogeneity of variance
I
Independence
Interaction
Interaction contrast
Interaction plot
L
Level
Levene’s test
Linearity
Lord’s paradox
M
Main effect
Marginal mean
Mean square
Moderation
O
Ordinal interaction
Orthogonality
P
Parallel profiles
Partial eta squared
Partial omega squared
Pooled within-group slope
Post hoc comparison
R
Residual
S
Simple effect
Standardized difference
Standardized residual
Sum of squares
Sum-to-zero contrasts
contr.sum before fitting an interacting factorial model for Type III tests in R.T
Three-way interaction
Type I sums of squares
Type II sums of squares
Type III sums of squares
U
Unbalanced design
Unweighted marginal mean
V
Vertical scale
W
Weighted marginal mean
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.