2 Two-way ANOVA with interaction
The previous subsection looked at two-way ANOVA under the assumption that there was no interaction between the factors and . We will now look at the developments of two-way ANOVA to take into account possible interaction between the factors under consideration. The following analysis allows us to test to see whether we have sufficient evidence to reject the null hypothesis that the amount of interaction is effectively zero.
To see how we might consider interaction between factors and taking place, look at the following table which represents observations involving a two-factor experiment.
Factor B
|
|||||
Factor A | 1 | 2 | 3 | 4 | 5 |
1 | 3 | 5 | 1 | 9 | 12 |
2 | 4 | 6 | 2 | 10 | 13 |
3 | 6 | 8 | 4 | 12 | 15 |
A brief inspection of the numbers in the five columns reveals that there is a constant difference between any two rows as we move from column to column. Similarly there is a constant difference between any two columns as we move from row to row. While the data are clearly contrived, it does illustrate that in this case that no interaction arises from variations in the differences between either rows or columns. Real data do not exhibit such behaviour in general of course, and we expect differences to occur and so we must check to see if the differences are large enough to provide sufficient evidence to reject the null hypothesis that the amount of interaction is effectively zero.
Notation
Let represent the number of ‘levels’ present for factor , denoted
Let represent the number of ‘levels’ present for factor , denoted
Let represent the number of observations per cell. We assume that it is the same for each cell.
In the table above, . In the examples we shall consider, will be greater than 1 and we will be able to check for interaction between the factors.
We suppose that the observations at level of factor and level of factor are taken from a normal distribution with mean . When we assumed that there was no interaction, we used the additive model
So, for example, the difference between the means at levels 1 and 2 of factor is equal to and does not depend upon the level of factor . When we allow interaction, this is not necessarily true and we write
Here is an interaction effect . Now so the difference between two levels of factor depends on the level of factor .
2.1 Fixed and random effects
Often the levels assigned to a factor will be chosen deliberately. In this case the factors are said to be fixed and we have a fixed effects model . If the levels are chosen at random from a population of all possible levels, the factors are said to be random and we have a random effects model . Sometimes one factor may be fixed while one may be random . In this case we have a mixed effects model . In effect, we are asking whether we are interested in certain particular levels of a factor (fixed effects) or whether we just regard the levels as a sample and are interested in the population in general (random effects).
Calculation method
The data you will be working with will be set out in a manner similar to that shown below.
The table assumes observations per cell and is shown along with a variety of totals and means which will be used in the calculations of the various test statistics to follow.
Factor B
|
|||||||
Factor A | Level 1 | Level 2 | Level | Level | Totals | ||
Level 1 | |||||||
Level 2 | |||||||
Level |
|
||||||
Level | |||||||
Totals | |||||||
Notes
-
represents the grand total of the data values so that
- represents the total of the data in the th row.
- represents the total of the data in the th column.
- The total number of data entries is given by .
Partitioning the variation
We are now in a position to consider the partition of the total sum of the squared deviations from the overall mean which we estimate as
The total sum of the squared deviations is
and it can be shown that this quantity can be written as
where is the total sum of squares given by
is the sum of squares due to variations caused by factor given by
is the sum of squares due to variations caused by factor given by
Note that means which is the number of observations at each level of and means which is the number of observations at each level of .
is the sum of the squares due to variations caused by the interaction of factors and and is given by
Note that the quantity is the sum of the data in the cell and that the quantity is the sum of the squares between cells.
is the sum of the squares due to chance or experimental error and is given by
The number of degrees of freedom is partitioned as follows:
Note that there are degrees of freedom between cells and that the number of degrees of freedom for is given by
This gives rise to the following two-way ANOVA tables.
Two-Way ANOVA Table - Fixed-Effects Model
Source of Variation | Sum of squares SS | Degrees of Freedom | Mean Square MS | Value of F Ratio |
Factor | ||||
Factor | ||||
Interaction | ||||
Residual Error | ||||
Totals | ||||
Two-Way ANOVA Table - Random-Effects Model
Source of Variation | Sum of squares SS | Degrees of Freedom | Mean Square MS | Value of F Ratio |
Factor | ||||
Factor | ||||
Interaction | ||||
Residual Error | ||||
Totals | ||||
Two-Way ANOVA Table - Mixed-Effects Model
Case (i) fixed and random.
Source of Variation | Sum of squares SS | Degrees of Freedom | Mean Square MS | Value of F Ratio |
Factor | ||||
Factor | ||||
Interaction | ||||
Residual Error | ||||
Totals | ||||
Case (ii) A random and B fixed.
Source of Variation | Sum of squares SS | Degrees of Freedom | Mean Square MS | Value of F Ratio |
Factor | ||||
Factor | ||||
Interaction | ||||
Residual Error | ||||
Totals | ||||
Example 1
In an experiment to compare the effects of weathering on paint of three different types, two identical surfaces coated with each type of paint were exposed in each of four environments. Measurements of the degree of deterioration were made as follows.
Environment 1
|
Environment 2
|
Environment 3
|
Environment 4
|
|||||
Paint A | 10.89 | 10.74 | 9.94 | 11.25 | 9.88 | 10.13 | 14.11 | 12.84 |
Paint B | 12.28 | 13.11 | 14.45 | 11.17 | 11.29 | 11.10 | 13.44 | 11.37 |
Paint C | 10.68 | 10.30 | 10.89 | 10.97 | 10.61 | 11.00 | 12.22 | 11.32 |
Making the assumptions of normality, independence and equal variance, derive the appropriate ANOVA tables and state the conclusions which may be drawn at the 5% level of significance in the following cases.
- The types of paint and the environments are chosen deliberately because the interest is in these paints and these environments.
- The types of paint are chosen deliberately because the interest is in these paints but the environments are regarded as a sample of possible environments.
- The types of paint are regarded as a random sample of possible paints and the environments are regarded as a sample of possible environments.
Solution
We know that
- Case 1.
- is described as a fixed-effects model,
- Case 2.
- is described as a mixed-effects model (paint type fixed) and
- Case 3.
- is described as a random-effects model.
In all three cases the calculations necessary to find (paints), (environments), and are identical. Only the calculation and interpretation of the test statistics will be different. The calculations are shown below.
Subtracting 10 from each observation, the data become:
The total sum of squares is
We can simplify the calculation by finding the between samples sum of squares
Sum of squares for paints is
Sum of squares for environments is
So the interaction sum of squares is and
the residual sum of squares is The results are combined in the following ANOVA table
The following conclusions may be drawn. There is insufficient evidence to support the interaction hypothesis in any case. Therefore we can look at the tests for the main effects.
- Case 1.
- Since we have sufficient evidence to conclude that paint type affects the degree of deterioration. Since we have sufficient evidence to conclude that environment affects the degree of deterioration.
- Case 2.
- Since we do not have sufficient evidence to reject the hypothesis that paint type has no effect on the degree of deterioration. Since we have sufficient evidence to conclude that environment affects the degree of deterioration.
- Case 3.
- Since we do not have sufficient evidence to reject the hypothesis that paint type has no effect on the degree of deterioration. Since we do not have sufficient evidence to reject the hypothesis that environment has no effect on the degree of deterioration.
If the test for interaction had given a significant result then we would have concluded that there was an interaction effect. Therefore the differences between the average degree of deterioration for different paint types would have depended on the environment and there might have been no overall ‘best paint type’. We would have needed to compare combinations of paint types and environments. However the relative sizes of the mean squares would have helped to indicate which effects were most important.
Task!
A motor company wishes to check the influences of tyre type and shock absorber settings on the roadholding of one of its cars. Two types of tyre are selected from the tyre manufacturer who normally provides tyres for the company’s new vehicles. A shock absorber with three possible settings is chosen from a range of shock absorbers deemed to be suitable for the car. An experiment is conducted by conducting roadholding tests using each tyre type and shock absorber setting. The (coded) data resulting from the experiment are given below.
Factor |
Shock Absorber Setting
|
||
Tyre | B1=Comfort | B2=Normal | B3=Sport |
5 | 8 | 6 | |
Type A1 | 6 | 5 | 9 |
8 | 3 | 12 | |
9 | 10 | 12 | |
Type A2 | 7 | 9 | 10 |
7 | 8 | 9 | |
Decide whether an appropriate model has random-effects, mixed-effects or fixed-effects and derive the appropriate ANOVA table. State clearly any conclusions that may be drawn at the 5% level of significance.
We know that both the tyres and the shock absorbers are not chosen at random from populations consisting of all possible tyre types and shock absorber types so that their influence is described by a fixed-effects model. The calculations necessary to find and are shown below.
B1 | B2 | B3 | Totals | |
5 | 8 | 6 | ||
A1 | 6 | 5 | 9 | |
8 | 3 | 12 | ||
9 | 10 | 12 | ||
A2 | 7 | 9 | 10 | |
7 | 8 | 9 | ||
Totals | ||||
The sums of squares calculations are:
The results are combined in the following ANOVA table.
Source | SS | DoF | (Fixed) | (Fixed) | |
Factor | 20.056 | 1 | 20.056 | 5.39 | |
Factor | 26.778 | 2 | 13.389 | 3.60 | |
Interaction | 5.444 | 2 | 2.722 | 0.731 | |
Residual | 44.666 | 12 | 3.722 | ||
Totals | 96.944 | 17 | |||
The following conclusions may be drawn:
Interaction: There is insufficient evidence to support the hypothesis that interaction takes place between the factors.
Factor : Since we have sufficient evidence to reject the hypothesis that tyre type does not affect the roadholding of the car.
Factor : Since we do not have sufficient evidence to reject the hypothesis that shock absorber settings do not affect the roadholding of the car.
Task!
The variability of a measured characteristic of an electronic assembly is a source of trouble for a manufacturer with global manufacturing and sales facilities. To investigate the possible influences of assembly machines and testing stations on the characteristic, an engineer chooses three testing stations and three assembly machines from the large number of stations and machines in the possession of the company. For each testing station - assembly machine combination, three observations of the characteristic are made.
The (coded) data resulting from the experiment are given below.
Factor |
Testing Station
|
||
Assembly Machine | B1 | B2 | B3 |
2.3 | 3.7 | 3.1 | |
A1 | 3.4 | 2.8 | 3.2 |
3.5 | 3.7 | 3.5 | |
3.5 | 3.9 | 3.3 | |
A2 | 2.6 | 3.9 | 3.4 |
3.6 | 3.4 | 3.5 | |
2.4 | 3.5 | 2.6 | |
A3 | 2.7 | 3.2 | 2.6 |
2.8 | 3.5 | 2.5 | |
Decide whether an appropriate model has random-effects, mixed-effects or fixed-effects and derive the appropriate ANOVA table.
State clearly any conclusions that may be drawn at the 5% level of significance.
Both the machines and the testing stations are effectively chosen at random from populations consisting of all possible types so that their influence is described by a random-effects model. The calculations necessary to find and are shown below.
B1 | B2 | B3 | Totals | |
2.3 | 3.7 | 3.1 | ||
A1 | 3.4 | 2.8 | 3.2 | |
3.5 | 3.7 | 3.5 | ||
3.5 | 3.9 | 3.3 | ||
A2 | 2.6 | 3.9 | 3.4 | |
3.6 | 3.4 | 3.5 | ||
2.4 | 3.5 | 2.6 | ||
A3 | 2.7 | 3.2 | 2.6 | |
2.8 | 3.5 | 2.5 | ||
Totals | ||||
and the sums of squares calculations are:
The results are combined in the following ANOVA table
Source | (Random) | (Random) | |||
Factor | 1.602 | 2 | 0.801 | 8.05 | |
(Machines) | |||||
Factor | 1.447 | 2 | 0.724 | 7.28 | |
(Stations) | |||||
Interaction | 0.398 | 4 | 0.099(5) | 0.728 | |
Residual | 2.460 | 18 | 0.136 | ||
Totals | 5.907 | 26 | |||
The following conclusions may be drawn.
Interaction: There is insufficient evidence to support the hypothesis that interaction takes place between the factors.
Factor : Since we have sufficient evidence to reject the hypothesis that the assembly machines do not affect the assembly characteristic.
Factor : Since we have sufficient evidence to reject the hypothesis that the choice of testing station does not affect the assembly characteristic.