Two-way ANOVA examines how two categorical factors relate to a numeric outcome, both separately and together. This guide explains what it is, how it differs from one-way ANOVA and regression, when to use it, how main effects and interactions work, and how to run it in AnalyZ Solutions.
One-way ANOVA compares group averages across one grouping variable. Many real questions involve two. Two-way ANOVA studies two grouping variables at the same time. Each grouping variable is called a factor, and each category within it is a level. Crossing the two factors creates cells, one for every combination of levels. Gender with two levels and delivery method with two levels, for example, gives four cells: women online, women in person, men online, and men in person.
Like one-way ANOVA, it works by splitting the variation in the outcome. Here the variation is divided into four parts: variation explained by the first factor, by the second factor, by the interaction between them, and variation left unexplained within the cells. Each effect is compared with the unexplained variation to give an F statistic and a significance level.
Two-way ANOVA answers three questions in one analysis.
The third question is often the most interesting. An interaction means the combination matters, and the factors cannot be described one at a time. If online delivery raises scores for women and lowers them for men, the overall online average may look the same as the in-person average, because the opposite effects cancel out. The main effects would suggest that delivery does not matter, when it matters a great deal for each gender.
The easiest way to spot an interaction is to plot the cell averages, with one line for each level of one factor. Parallel lines mean the effect of the factor on the horizontal axis is the same for both groups, so there is no interaction. Lines that cross, or that fan out so that the gap changes, mean the effect differs between groups.
Two separate analyses would each ignore the other factor. That wastes information, because variation due to the second factor is left in the unexplained part and makes each test less sensitive. It also makes it impossible to detect an interaction, since each analysis sees only one factor at a time. Analysing both together is more informative and uses the data more efficiently.
Two-way ANOVA is easiest to read when every cell holds about the same number of cases, which is called a balanced design. Experiments tend to produce balanced designs, while surveys rarely do. When cell sizes differ a lot, the effects of the two factors overlap, and the results depend on how the software divides up the shared variation.
| Feature | One-way ANOVA | Two-way ANOVA | Linear regression |
|---|---|---|---|
| Grouping variables | One factor | Two factors that cross each other | Any number of categorical and numeric predictors |
| Questions answered | Do the groups differ? | Does each factor matter, and does the effect of one depend on the other? | How does the outcome change with each predictor, holding the others constant? |
| Interaction | Not applicable | Tested directly | Possible in general statistical software, but not available in the AnalyZ Solutions regression module |
| Follow-up comparisons | Pairwise differences between groups | Cell averages, then separate tests | Coefficients against a reference category |
| Covariates such as age | No | No | Yes |
Two-way ANOVA is a regression with two categorical predictors and their interaction. In a balanced design, the F tests for the two main effects and the interaction match the ones from a regression fitted to the same data, so the choice does not change the conclusion. The general relationship between ANOVA and regression is covered in the one-way ANOVA guide.
The practical difference is flexibility. Regression can add numeric predictors such as age, can include more than two factors, and copes better when cell sizes are unequal. In AnalyZ Solutions, however, the regression module has no interaction terms. Two-way ANOVA is therefore the way to test whether the effect of one categorical factor depends on another.
Use it when all of these hold:
Typical examples are test scores by gender and course delivery, crop yield by fertiliser and irrigation method, customer spending by store type and season, and recovery time by treatment and age group.
Choose a different method when your situation changes:
The assumptions match one-way ANOVA: independent observations, roughly normal outcomes within each cell, and similar spread across cells. Two-way ANOVA is also easiest to interpret when the cells are of roughly similar size. When some cells are much smaller than others, the main effect estimates become harder to separate from each other, and results can differ between software packages that partition the variation in different ways. Aim for at least 10 to 15 respondents per cell if you can.
If the interaction is significant, interpret it first. The effect of each factor depends on the other, so statements about main effects alone can mislead. The interpretation in AnalyZ Solutions leads with the interaction when it is significant, telling you that the effect of one factor depends on the level of the other.
To understand the pattern, read the cell averages in the descriptives table. Compare, for instance, the online and in-person averages separately for women and for men.
If the interaction is not significant, the main effects can be read on their own. Each one asks whether the outcome differs across the levels of that factor when the other factor is averaged over.
Each row of the table has an eta-squared, the share of total variation explained by that effect. Under 6% is small, 6% to 14% medium, and over 14% large.
Open Inferential Analysis, choose Compare Means, then Two-way ANOVA.
Running two-way ANOVA in AnalyZ Solutions.
The table does not include automatic follow-up comparisons between cells. If the interaction is significant, use the cell averages to describe the pattern, and run a t-test within one level of a factor if you need a specific comparison.
The figures below are invented to show the steps, and they follow the results tables in AnalyZ Solutions, with a few columns left out to save space. Suppose test scores were recorded for 20 students in each combination of gender and course delivery (online or in person).
| Gender | Delivery | N | Mean | SD |
|---|---|---|---|---|
| Female | Online | 20 | 78.0 | 8.0 |
| Female | In person | 20 | 70.0 | 8.0 |
| Male | Online | 20 | 68.0 | 8.0 |
| Male | In person | 20 | 76.0 | 8.0 |
| Source | SS | df | MS | F | p-value | Sig | η² |
|---|---|---|---|---|---|---|---|
| Gender | 80.0 | 1 | 80.0 | 1.2500 | 0.2671 | ns | 0.013 |
| Delivery | 0.0 | 1 | 0.0 | 0.0000 | 1.0000 | ns | 0.000 |
| Gender × Delivery | 1280.0 | 1 | 1280.0 | 20.0000 | < 0.001 | *** | 0.206 |
| Error | 4864.0 | 76 | 64.0 |
The best delivery method depends on gender. Women did better online, and men did better in person, and the interaction is significant at the 0.1% level and large. Reporting either factor alone would have suggested that neither matters. Because the module gives no follow-up tests between cells, describe the pattern from the cell averages, and run a separate t-test within one gender if you need a formal comparison.
Interpreting main effects when an interaction is present. The main effects average over a pattern that differs between levels, and the average can describe nobody.
Empty or tiny cells. If one combination has very few respondents, its average is unreliable. Check the counts in the descriptives table.
Treating a non-significant interaction as proof of parallel effects. Interaction tests have low power, especially in small samples.
Using it for more than two factors. Add further predictors through linear regression.
Open Compare Means in AnalyZ Solutions. Free to sign up, free to analyze.
Get started