← 2. Comparing groups

Two-Way ANOVA

A method that tests the main effects and interaction of two factors together to analyze under which conditions differences in group means change.

Two independent variablesMain effectsInteractionSimple effects

Quiet settingNoisy settingLectureDiscussionHands-onComparing means across every combination of the two factors

How much do exam scores differ by study method? Even with the same method, are results different when studying in a quiet classroom versus a noisy setting? Is a particular study method especially effective in a certain setting?

In cases like these, the method that compares the effects of two factors on a single outcome variable together is two-way ANOVA. It tests not only each factor’s mean differences but also the interaction that appears when the two factors are combined.

Where a one-way ANOVA checks differences in group means across one factor, a two-way ANOVA separates the main effects of two factors from their interaction. What is especially important is that it checks whether the effect of one factor changes depending on the level of the other factor.

It is used in education, psychology, marketing, product experiments and other research where a combination of two conditions can affect the outcome. In this article we’ll use study method and study setting as an example to go through the principle of the analysis, interaction plots, the results table, follow-up comparisons and cautions, in that order.

SECTION 1

What is two-way ANOVA?

It looks at how two categorical factors together affect one continuous outcome.

Two-way ANOVA analyzes mean differences across two categorical independent variables. It tests not only how each factor affects the outcome but also whether the outcome changes depending on the combination of the two factors.

Key questions: Do exam scores differ by study method? Do scores differ by study setting? And does the effect of study method change depending on the setting?
SECTION 2

What changes when there are two independent variables?

You can see the interaction between the two factors, beyond a single mean difference.

A one-way ANOVA compares only one factor, such as study method. A two-way ANOVA handles study method and study setting at the same time, checking the mean differences for each factor and also looking at whether which method works better depends on the setting.

TypeOne-way ANOVATwo-way ANOVA
Independent variables1: study method2: study method and setting
What is testedMean differences by study methodMethod main effect, setting main effect, interaction
Typical visualizationMeans and distributions by groupMeans by factor combination, interaction plot
SECTION 3

How do you tell main effects and interactions apart?

Understand the three tests in a two-way ANOVA as answers to different questions.

Main effect of study method

Looks at whether scores differ among lecture, discussion and hands-on learning when the quiet and noisy settings are averaged.

Main effect of study setting

Looks at whether scores differ between the quiet and noisy settings when the three study methods are averaged.

Study method × study setting interaction

If the difference between settings varies from one study method to another, there is an interaction. For example, discussion-based learning might show a large score difference in the noisy setting while hands-on learning does not.

Order of interpretation: Check the interaction first, and if it is significant, analyze the simple effects within each condition. When the interaction matters, don’t draw conclusions from the main effects alone.
SECTION 4

Worked example: exam scores by study method and setting

Comparing the six conditions of a 3×2 factorial design.

Study method was divided into three types (lecture, discussion and hands-on) and study setting into two (quiet and noisy). We assume a hypothetical experiment (120 students in total) in which 20 different students were assigned to each condition. The values below are example means for explaining the structure of the analysis, not actual test results.

Study methodQuiet settingNoisy settingMean by method
Lecture72 points78 points75 points
Discussion76 points90 points83 points
Hands-on80 points82 points81 points
Mean by setting76 points83.3 points79.7 points
607080907278Lecture7690Discussion8082Hands-onQuiet settingNoisy setting
Mean scores by study method × setting
SECTION 5

How do you read an interaction plot?

Look not just at the height of the means but at how the differences between groups change.

For lecture, the mean in the noisy setting is 6 points higher; for discussion it is 14 points higher; and for hands-on it is 2 points higher. The size of the setting difference varies by method. This is a pattern that suggests an interaction, but statistical significance cannot be judged from the plot alone.

Even if the lines in an interaction plot don’t cross, an interaction can be present if their slopes differ. It must be confirmed with an F test that takes into account the sample size and score variation in each cell.

SECTION 6

How is two-way ANOVA calculated?

It splits the total variation into two main effects, the interaction and error.

It decomposes the variation in each student’s score into differences due to study method, differences due to study setting, the interaction of the two factors, and unexplained error. For each factor, the F value is obtained by comparing its mean square with the appropriate error mean square.

Source of variationMeaningDegrees of freedom in this example
Study method (A)Differences among the three method means2
Study setting (B)Difference between the two setting means1
A × BDifferences in the setting effect across methods2
ErrorScore differences among students in the same condition114
TotalVariation in all the scores119
Study method (A)2+Study setting (B)1+A × B2+Error114= total 119
Partitioning the degrees of freedom in a two-way ANOVA

Degrees of freedom for a complete, balanced 3×2 design with 20 students per cell. Test statistics can only be calculated from actual observed scores.

SECTION 7

What figures do you look at in the results table?

Read the F value, p-value and effect size separately for each of the three effects.

An actual results table reports the sum of squares (SS), degrees of freedom (df), mean square (MS), F value, p-value and effect size for each of the three effects: study method, setting and method × setting.

EffectHypothesis testedWhat to interpret
Study methodAre all the method means equal?Method differences pooled over settings
Study settingAre the setting means equal?Setting difference pooled over methods
Method × settingIs the setting effect the same across methods?Differences in the effect of study method by setting
Caution on the numbers: The example specifies only the cell means. Because there are no individual scores or residuals, we do not present F values, p-values or partial η² as if they had been calculated.
SECTION 8

If the interaction is significant, what comes next?

Use simple effects and condition-by-condition comparisons to find where the differences arise.

If the interaction is statistically significant, compare the three study methods within each study setting, or compare the quiet and noisy settings within each study method. Because several comparisons are made, consider a multiple-comparison correction such as Holm’s.

Follow-up comparisonQuestion it answers
Comparing the three methods in the quiet settingWhen it’s quiet, which methods differ?
Comparing the three methods in the noisy settingWhen it’s noisy, which methods differ?
Comparing settings within each methodFor which method does the setting effect stand out?
7075808590Lecture+6Discussion+14Hands-on+2Quiet settingNoisy setting
Setting effect by method

Presenting the mean differences of the simple effects with their 95% confidence intervals makes it easier to understand in what direction and how strongly the interaction actually appeared.

SECTION 9

What assumptions should you check before the analysis?

Check independence of observations, normality of residuals and homogeneity of variance across cells.

Independence

Each student belongs to one condition, and the observations must be independent of one another. If the same students were measured repeatedly under several conditions, the design differs from a simple independent-groups two-way ANOVA.

Normality of residuals and outliers

Examine the distribution of residuals in each condition and how extreme values affect the analysis. Normality is assessed mainly from the model residuals rather than from all the raw scores.

Homogeneity of variance

Check that the score variances in the six conditions are not very different. You can use Levene’s test and residual plots, and if the assumption is violated, consider robust methods or a suitable alternative model.

Note: Sphericity is an assumption about repeated-measures factors. It does not apply to the independent-groups 3×2 two-way ANOVA discussed here.
SECTION 10

What if sample sizes differ or there are missing data?

In an unbalanced design, you must clearly decide on the type of sums of squares and the basis for comparison.

When the sample sizes of the combinations differ, interpreting the main-effect means and the interaction becomes more complicated than in a balanced design. You then need to check the calculation basis, such as Type II or Type III sums of squares, the contrast coding and how the estimated marginal means are defined. It’s important to decide in advance which hypotheses are being tested in a model that includes the interaction.

If missing data are concentrated in particular conditions, or the group variances differ greatly, the results can be distorted. Rather than simply deleting missing values, check why the data are missing and report the analyzable sample and the limitations.

SECTION 11

How does it differ from other types of ANOVA?

Choose based on the number of factors, whether there are repeated measures and whether covariates are used.

MethodDesign featuresWhen to use it
One-way ANOVA1 independent variableComparing scores by study method
Two-way ANOVA2 independent variablesMain effects and interaction of method and setting
ANCOVACategorical factor + continuous covariateComparing groups while controlling for pretest scores
Repeated measures ANOVASame participants measured at several timesComparing pre-, post- and follow-up training scores
Mixed design ANOVABetween-subjects factor + within-subjects repeated factorComparing change over time in a training group and a comparison group
MANOVA / MANCOVASeveral outcome variablesComparing understanding, satisfaction and other outcomes together

Both factors in a two-way ANOVA are categorical. Having two factors does not by itself make a design a mixed design; the key distinction is whether the same participants were measured repeatedly.

SECTION 12

How do you report the results?

Organize them in this order: study design, descriptive statistics, the three effect tests, follow-up comparisons.

First present the 3×2 factorial design and each condition’s sample size, mean and standard deviation. Then report the assumption checks and the F value, degrees of freedom, p-value and effect size for the two main effects and the interaction. If the interaction is significant, add the simple effects analysis and the corrected follow-up comparisons.

Example report sentences (descriptive statistics):

Exam scores were compared across combinations of study method (lecture, discussion, hands-on) and study setting (quiet, noisy). In the hypothetical means, discussion-based learning scored 76 points in the quiet setting and 90 points in the noisy setting, while hands-on learning scored 80 and 82 points, respectively. Whether this pattern of means is a statistically significant interaction must be tested with a two-way ANOVA using the individual observations.

After the actual analysis, report the interaction result in a format such as F(2, 114) = [value], p = [value], partial η² = [value]. The bracketed values must be replaced with the actual results.

SECTION 13

Where can two-way ANOVA be used?

It suits research in which a combination of two conditions affects the outcome.

FieldFirst factorSecond factorOutcome variable
EducationTeaching methodStudy settingExam score
MarketingAd typeCustomer age groupBrand attitude score
ManufacturingProcess temperature levelPressure levelProduct strength
PsychologyFeedback typeTask difficultyPerformance score
HealthIntervention typeAge groupHealth-related scale

Two-way ANOVA is useful when two factors need to be analyzed together. The scope of causal interpretation depends, however, on whether the design is a randomized experiment or an observational study.

✓ Wrap-up

Two-way ANOVA is a way to understand the differences that two factors create together.

It looks not only at each factor’s mean differences but also at where the factors change each other’s effects.


Comparing study method and study setting together goes beyond simply asking which method has the higher mean: it shows that the same method can give different results depending on the setting. In this hypothetical example, the mean difference between settings varied by study method. But to say the difference is actually meaningful, you need to run an interaction test on the individual data.

When reporting the results, distinguish the two main effects from the interaction, and if there is a significant interaction, use simple effects and follow-up comparisons to explain under which conditions the differences arise. Accurate interpretation also requires checking each condition’s sample size, the residuals and homogeneity of variance, and the study design.

KEY TAKEAWAY

The key to two-way ANOVA is not stopping at looking at each factor’s mean differences, but checking whether the effect of one factor changes with the level of the other. So check the interaction first and interpret the results with the condition-by-condition comparisons you need.