Two Way Analysis of Variance


Menu location: Analysis_Analysis of Variance_Two Way.


This function calculates ANOVA for a two way randomized block experiment. There are overall tests for differences between treatment means and between block means. Multiple comparison methods are provided for pairs of treatment means.


Consider data classified by two factors such that each level of one factor can be combined with all levels of the other factor:


    Treatment (i, 1 to k)
    1 2 ... k
Block (j, 1 to b) 1 Yij      


In the example below there is a study of different treatments on clotting times. Response/outcome variable Y is the observed clotting time for blood samples. Blocks are individuals who donated a blood sample. Treatments are different methods by which portions of each of the blood samples are processed.


Unlike one way ANOVA, the F tests for two way ANOVA are the same if either or both block and treatment factors are considered fixed or random:

- where F is the variance ratio for tests of equality of treatment and block means, MST is the mean square due to treatments/groups (between groups), MSB is the mean square due to blocks (between blocks), MSE is the mean square due to error (within groups, residual mean square), Yij is an observation, Y bar i. is a treatment group mean, Y bar .j is a block mean and Y bar .. is the grand mean of all observations.


If you wish to use a two way ANOVA but your data are clearly non-normal then you should consider using the Friedman test, a nonparametric alternative.


Please note that many statistical software packages and texts present multiple comparison methods for treatment group means only in the context of one way ANOVA. StatsDirect extends this to two way ANOVA by using the treatment group mean square from two way ANOVA for multiple comparisons. Treatment effects must be fixed for this use of multiple comparisons to be valid. See Hsu (1996) for further discussion.



From Armitage and Berry (1994, p. 241).

Test workbook (ANOVA worksheet: Treatment 1, Treatment 2, Treatment 3, Treatment 4).


The following data represent clotting times (mins) of plasma from eight subjects treated in four different ways. The eight subjects (blocks) were allocated at random to each of the four treatment groups.


Treatment 1 Treatment 2 Treatment 3 Treatment 4
8.4 9.4 9.8 12.2
12.8 15.2 12.9 14.4
9.6 9.1 11.2 9.8
9.8 8.8 9.9 12.0
8.4 8.2 8.5 8.5
8.6 9.9 9.8 10.9
8.9 9.0 9.2 10.4
7.9 8.1 8.2 10.0


To analyse these data in StatsDirect you must first prepare them in four workbook columns appropriately labelled. Alternatively, open the test workbook using the file open function of the file menu. Then select Two Way from the Analysis of Variance section of the analysis menu. Select the columns marked "Treatment 1", "Treatment 2","Treatment 3" and "Treatment 4" in one action when prompted for data.


For this example:


Two way randomized block analysis of variance 


Variables: Treatment 1, Treatment 2, Treatment 3, Treatment 4


Source of Variation Sum Squares DF Mean Square
Between blocks (rows) 78.98875 7 11.284107
Between treatments (columns) 13.01625 3 4.33875
Residual (error) 13.77375 21 0.655893
Corrected total 105.77875 31  


F (VR between blocks) = 17.204193 P < .0001


F (VR between treatments) = 6.615029 P = .0025


Here we can see that there was a statistically highly significant difference between mean clotting times across the groups. The difference between subjects is of no particular interest here.


P values

multiple comparisons

analysis of variance