Aim:- To test whether there is significant difference between the row means as well as column
means.

Problem: The following data represent the number of units of production per day turned out by
different workers using 4 different types of machines.
Test whether the five men differ with respect to mean productivity and test whether the mean
productivity is the same for the four different machine types.
Null Hypothesis (H0)
: There is no significant difference between men and machines.
Alternate Hypothesis (H1)
: There is significant difference between men and machines.

R – Code:-
> data=c(44,38,47,36,46,40,52,43,34,36,44,32,43,38,46,33,38,42,49,39)
>data
[1] 44 38 47 36 46 40 52 43 34 36 44 32 43 38 46 33 38 42 49 39
>workers=gl(5,4)
>workers
[1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5
Levels: 1 2 3 4 5
>machine=gl(4,1,20)
>machine
[1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Levels: 1 2 3 4
>Twoway_Anova=aov(data~workers+machine)
>summary(Twoway_Anova)
Df
Sum Sq
Mean Sq
F value
Pr(>F)
workers
4
161.5
40.37
6.574
0.00485 **
machine
3
338.8
112.93
18.388
8.78e-05 ***
Residuals
12
73.7
6.14
>qf(.95, df1=4, df2=12)
[1] 3.259167
>qf(.95, df1=3, df2=12)
[1] 3.490295