Two-way analysis of variance

Command: Statistics
Next selectANOVA
Next selectTwo-way analysis of variance


The two-way analysis of variance is an extension to the one-way analysis of variance. There are two qualitative factors (A and B) on one dependent continuous variable Y.

Three null hypotheses are tested in this procedure:

  • factor A does not influence variable Y
  • factor B does not influence variable Y
  • the effect of factor A on variable Y does not depend on factor B (i.e. there is no interaction of factors A and B).

Two-way analysis of variance requires that there are data for each combination of the two qualitative factors A and B.

Required input

Select the (continuous) dependent variable (Y) and two discrete variables for the qualitative factors (A and B) suspected to influence the dependent variable. The qualitative factors A and B may either consist of numeric or alphanumeric data. One filter can also be defined in order to include only a selected subgroup of cases.

Two-way analysis of variance


Two-way analysis of variance

Levene's test for equality of variances

Prior to the ANOVA test, Levene's test for equality of variances is performed. If the Levene test is positive (P<0.05) then the variances in the groups are different (the groups are not homogeneous), and therefore the assumptions for ANOVA are not met.

Tests of Between-Subjects Effects

If the calculated P-values for the two main factors A and B, or for the 2-factor interaction is less than the conventional 0.05 (5%), then the corresponding null hypothesis is rejected, and you accept the alternative hypothesis that there is indeed a difference between groups.

When the 2-factor interaction is significant the effect of factor A is dependent on the level of factor B, and it is not recommended to interpret the means and differences between means (see below) of the main factors.

Estimated marginal means

In the following tables, the means with standard error and 95% Confidence Interval are given for all levels of the two factors. Also, differences between groups, with Standard Error, and Bonferroni corrected P-value and 95% Confidence Interval of the difference are reported.


  • Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
  • Armitage P, Berry G, Matthews JNS (2002) Statistical methods in medical research. 4th ed. Blackwell Science.
  • Neter J, Kutner MH, Nachtsheim CJ, Wasserman W (1996) Applied linear statistical models. 4th ed. McGraw-Hill.

See also

Privacy & cookies Contact Site map