Aim:- To test whether there is significant difference between the row means, column means and
treatments.

Problem:Four varieties A, B, C, D of a crop are tested in a Latin Square design with four
replications. The plot yields are given in kgs as below:
Analyze the experimental yield and state your conclusion.
Null Hypothesis (H0)
: All the varieties are equal.
Alternate Hypothesis (H1)
: All the varieties are not equal.

R – Code:-
> crops=c(rep("crop1",1), rep("crop2",1), rep("crop3",1), rep("crop4",1))
>crops
[1] "crop1" "crop2" "crop3" "crop4"
> treat <- c(rep("treatA",4), rep("treatB",4), rep("treatC",4), rep("treatD",4))
> treat
[1] "treatA" "treatA" "treatA" "treatA" "treatB" "treatB" "treatB" "treatB" "treatC" "treatC" "treatC" "treatC"
"treatD" "treatD" "treatD" "treatD"
> yields=c("A","C","D","B","C","A","B","D","B","D","C","A","D","B","A","C")
>yields
[1] "A" "C" "D" "B" "C" "A" "B" "D" "B" "D" "C" "A" "D" "B" "A" "C"
> freq=c(6,5,6,9,8,4,6,4,7,6,10,6,7,4,8,9)
>freq
[1] 6 5 6 9 8 4 6 4 7 6 10 6 7 4 8 9
>mydata=data.frame(treat, crops, yields, freq)
>myfitdata=lm(freq ~ crops+treat+yields, mydata)
> LSD=anova(myfitdata)
> LSD
Analysis of Variance Table
Response: freq
Df
Sum Sq
Mean Sq
F value
Pr(>F)
crops 3
18.1875
6.0625
2.5304
0.1536
treat
3
7.1875
2.3958
1.0000
0.4547
yields 3
12.1875
4.0625
1.6957
0.2663
Residuals
6
14.3750
2.3958
>qf(.95, df1=6, df2=3)
[1] 8.940645