# Two-way analysis of variance

Command: | Statistics ANOVA Two-way analysis of variance |

## Description

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.

### Residuals

Optionally, select a Test for Normal distribution of the residuals.

## Results

### 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.

## Analysis of residuals

Two-way ANOVA analysis assumes that the residuals (the differences between the observations and the estimated values) follow a Normal distribution. This assumption can be evaluated with a formal test, or by means of graphical methods.

The different formal Tests for Normal distribution may not have enough power to detect deviation from the Normal distribution when sample size is small. On the other hand, when sample size is large, the requirement of a Normal distribution is less stringent because of the central limit theorem.

Therefore, it is often preferred to visually evaluate the symmetry and peakedness of the distribution of the residuals using the Histogram, Box-and-whisker plot, or Normal plot.

To do so, you click the hyperlink "Save residuals" in the results window. This will save the residual values as a new variable in the spreadsheet. You can then use this new variable in the different distribution plots.

## Literature

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