# Two-way ANOVA (/docs/analyses/anova-twoway)



## When to use it [#when-to-use-it]

Use two-way ANOVA when two categorical factors might both affect a numeric outcome, and you care whether they combine. For example: do exam scores depend on teaching method, on morning versus afternoon, and on the combination of the two?

A significant interaction means the teaching gap is not the same in the morning as in the afternoon. You then describe the pattern in each combination, not just the two averages.

## Assumptions [#assumptions]

Scores are numeric and independent. Cell sizes should be adequate, and the spread of scores should be similar across cells.

Tensr does not run Levene’s test or Shapiro–Wilk for this procedure. There is no effect-size option. The featured metric is R², the proportion of outcome variance the full model accounts for. If you need a homogeneity check, it is not on this page.

## Running it in Tensr [#running-it-in-tensr]

<Steps>
  <Step>
    Analyze → General Linear Model → Two-Way ANOVA. In chat: “Two-way ANOVA of score by teaching and time.”
  </Step>

  <Step>
    Factor A and factor B are the two grouping columns. Value column is the numeric outcome.
  </Step>

  <Step>
    Include interaction starts on. Post hoc starts at none, with the same choices as one-way ANOVA: tukey, bonferroni, scheffe, games_howell.
  </Step>
</Steps>

## Options [#options]

<TypeTable
  type="{
  factor_a: {
    type: 'string',
    description: 'First grouping factor.',
  },
  factor_b: {
    type: 'string',
    description: 'Second grouping factor.',
  },
  value_column: {
    type: 'string',
    description: 'Numeric outcome.',
  },
  include_interaction: {
    type: 'boolean',
    description: 'Fit the factor A × factor B term. Off means two main effects only.',
    default: 'true',
  },
  post_hoc: {
    type: 'none | tukey | bonferroni | scheffe | games_howell',
    description: 'Pairwise comparisons. Printed only when this is not none.',
    default: 'none',
  },
  session_filter: {
    type: 'array',
    description: 'Optional filter passed through to the model. Leave unset in the dialog.',
  },
  decimal_places: {
    type: '0–6',
    description: 'Report output. Decimal places.',
    default: '3',
  },
  apa_format: {
    type: 'boolean',
    description: 'Report output. APA-style tables.',
    default: 'true',
  },
  include_charts: {
    type: 'boolean',
    description: 'Report output. Box plot of the outcome by factor A.',
    default: 'true',
  },
}"
/>

## Reading the output [#reading-the-output]

Teaching method and morning versus afternoon, on the same exam. Method was built to matter. Time of day was not, and the two were not built to interact.

| Source        | Sum of squares | df |     F | p-value |
| ------------- | -------------: | -: | ----: | ------: |
| method        |        523.351 |  2 | 4.018 |    .021 |
| time          |           5.95 |  1 | 0.091 |    .763 |
| method × time |        166.676 |  2 |  1.28 |    .283 |
| Residual      |      5,861.811 | 90 |     — |       — |

| Group A | Group B  | Mean difference | p (adj) | \* | CI low | CI high | Reject H₀ |
| ------- | -------- | --------------: | ------: | -- | -----: | ------: | --------- |
| Lecture | Online   |           4.025 |    .118 |    | -0.771 |   8.822 | False     |
| Lecture | Workshop |           5.531 |    .020 | \* |  0.735 |  10.328 | True      |
| Online  | Workshop |           1.506 |    .736 |    |  -3.29 |   6.303 | False     |

Method is associated with the exam, F = 4.018, p = .021. Time of day is not, F = 0.091, p = .763. The method × time interaction is not either, F = 1.28, p = .283. Tukey then compares teaching methods. Only some pairs clear .05, which is what a moderate gap looks like when the groups overlap.

## Reporting (APA 7) [#reporting-apa-7]

A two-way ANOVA on exam score (N = 96) found a method effect, F = 4.018, p = .021, no time-of-day effect, F = 0.091, p = .763, and no method × time interaction, F = 1.28, p = .283.

## Coming from SPSS [#coming-from-spss]

Analyze → General Linear Model → Univariate.

SPSS Univariate can print partial η², estimated marginal means, and Levene’s test from the Options button. Tensr’s table has F and p, plus R² as a metric, and does not print partial η² or a homogeneity test. ANCOVA in Tensr is a separate menu item, not a covariate you add inside this dialog.

## Related [#related]

One factor only: [one-way ANOVA](/docs/analyses/anova-oneway). Three factors: [three-way ANOVA](/docs/analyses/anova-threeway). A numeric control variable: [ANCOVA](/docs/analyses/ancova).
