LSD
Question
Case:
Experiment to test five cattle rations – Experiment will be run in five seasons using the same set of coves. Milk
yield and some physiological and anatomical measurements will be taken as response variables
Excell
Row Col Trt Yield
1 1 1 24
2 1 2 17
3 1 3 18
4 1 4 26
5 1 5 22
1 2 2 20
2 2 3 24
3 2 4 38
4 2 5 31
5 2 1 30
1 3 3 19
2 3 4 30
3 3 5 26
4 3 1 26
5 3 2 20
1 4 4 24
2 4 5 27
3 4 1 27
4 4 2 23
5 4 3 29
1 5 5 24
2 5 1 36
R studio
install.packages("agricolae")
library(agricolae)
install.packages("dae")
library(dae)
install.packages("gglpot2")
library(ggplot2)
install.packages("car")
library(car)
install.packages("ExpDes")
library(ExpDes)
install.packages("rsm")
library(rsm)
trt=c("A","B","C","D","E")
design.lsd(trt, serie = 2, seed = 0, kinds = "Super-Duper",first=TRUE,randomization=TRUE)
data=read.table("clipboard",header=1)
data
data$Row=as.factor(data$Row)
data$Col=as.factor(data$Col)
data$Trt=as.factor(data$Trt)
lsd.aov=aov(Yield~Row+Col+Trt,data)
summary(lsd.aov)
Lsd.test=LSD.test(lsd.aov,"Trt")
Lsd.test
par(mfrow=c(2,2))
plot(lsd.aov)
boxplot(data$Yield~data$Trt,main=("Comparative Box Plot"),xlab = "Treatment",ylab="Yield",col="black")
Rstudio result
> trt=c("A","B","C","D","E")
>
> design.lsd(trt, serie = 2, seed = 0, kinds = "Super-Duper",first=TRUE,randomization=TRUE
$parameters
$parameters$design
[1] "lsd"
$parameters$trt
[1] "A" "B" "C" "D" "E"
$parameters$r
[1] 5
$parameters$serie
[1] 2
$parameters$seed
[1] 488092011
$parameters$kinds
[1] "Super-Duper"
$parameters[[7]]
[1] TRUE
$sketch
[,1] [,2] [,3] [,4] [,5]
[1,] "D" "C" "E" "A" "B"
[2,] "B" "A" "C" "D" "E"
[3,] "A" "E" "B" "C" "D"
[4,] "E" "D" "A" "B" "C"
[5,] "C" "B" "D" "E" "A"
$book
plots row col trt
1 101 1 1 D
2 102 1 2 C
3 103 1 3 E
4 104 1 4 A
5 105 1 5 B
6 201 2 1 B
7 202 2 2 A
8 203 2 3 C
9 204 2 4 D
10 205 2 5 E
11 301 3 1 A
12 302 3 2 E
13 303 3 3 B
14 304 3 4 C
15 305 3 5 D
16 401 4 1 E
17 402 4 2 D
18 403 4 3 A
19 404 4 4 B
20 405 4 5 C
21 501 5 1 C
22 502 5 2 B
23 503 5 3 D
24 504 5 4 E
25 505 5 5 A
>
> data=read.table("clipboard",header=1)
> data
Row Col Trt Yield
1 1 1 1 24
2 2 1 2 17
3 3 1 3 18
4 4 1 4 26
5 5 1 5 22
6 1 2 2 20
7 2 2 3 24
8 3 2 4 38
9 4 2 5 31
10 5 2 1 30
11 1 3 3 19
12 2 3 4 30
13 3 3 5 26
14 4 3 1 26
15 5 3 2 20
16 1 4 4 24
17 2 4 5 27
18 3 4 1 27
19 4 4 2 23
20 5 4 3 29
21 1 5 5 24
22 2 5 1 36
>
> data$Row=as.factor(data$Row)
> data$Col=as.factor(data$Col)
> data$Trt=as.factor(data$Trt)
>
> lsd.aov=aov(Yield~Row+Col+Trt,data)
> summary(lsd.aov)
Df Sum Sq Mean Sq F value Pr(>F)
Row 4 79.4 19.85 1.779 0.2170
Col 4 213.4 53.34 4.782 0.0241 *
Trt 4 220.3 55.08 4.938 0.0220 *
Residuals 9 100.4 11.16
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Lsd.test=LSD.test(lsd.aov,"Trt")
> Lsd.test
$statistics
MSerror Df Mean CV
11.15556 9 25.5 13.09801
$parameters
test p.ajusted name.t ntr alpha
Fisher-LSD none Trt 5 0.05
$means
Yield std r se LCL UCL Min Max Q25 Q50 Q75
1 28.6 4.669047 5 1.493690 25.22104 31.97896 24 36 26.00 27.0 30.00
2 20.0 2.449490 4 1.669997 16.22221 23.77779 17 23 19.25 20.0 20.75
3 22.5 5.066228 4 1.669997 18.72221 26.27779 18 29 18.75 21.5 25.25
4 29.5 6.191392 4 1.669997 25.72221 33.27779 24 38 25.50 28.0 32.00
5 26.0 3.391165 5 1.493690 22.62104 29.37896 22 31 24.00 26.0 27.00
$comparison
NULL
$groups
Yield groups
4 29.5 a
1 28.6 a
5 26.0 ab
3 22.5 bc
2 20.0 c
attr(,"class")
[1] "group"
>
> par(mfrow=c(2,2))
> plot(lsd.aov)
>
> boxplot(data$Yield~data$Trt,main=("Comparative Box Plot"),xlab = "Treatment",ylab="Yield
ack")
>
Interpretation
Assumption
Data from population are normally distributed
Population has equal variance
Samples are randomly and independently drowned
𝜖𝑖𝑗~𝑖𝑖𝑑𝑛 0, 𝜎𝜖 2
Hypothesis
Null hypothesis: Mean heights are same for all the treatments
Alternative hypothesis: At least one of the height is different out of the five treatments
Rejection Criteria
At 95% confidence level,
P value obtain is less than 0.05 reject the null hypothesis
Results
> summary(lsd.aov)
Df Sum Sq Mean Sq F value Pr(>F)
Row 4 79.4 19.85 1.779 0.2170
Col 4 213.4 53.34 4.782 0.0241 *
Trt 4 220.3 55.08 4.938 0.0220 *
Residuals 9 100.4 11.16
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
Here P value is less than 0.05 (P < 0.05)
ANOVA is significant
at 95% confidence level reject the Null Hypothesis
Conclusion
At 95% confidence Level, at least height of two treatments are statistically significantly Different.
Residual Analysis
Standardized residuals
Residuals vs Fitted Q-Q Residuals
1 20 8 8 20 1
Residuals
1.0
2
-2
-1.0
20 25 30 35 -2 -1 0 1 2
Fitted values Theoretical Quantiles
Standardized residuals
Standardized residuals
Scale-Location Residuals vs Leverage
1 20 1
1 2
0.0 0.6 1.2
8 1
20
8 0.5
-1
Cook's distance 0.5
20 25 30 35 0.0 0.2 0.4 0.6
Fitted values Leverage
Here,
Residuals vs Fitted plot does not show funnel shape distribution of data points.
Q-Q Residuals plot gets linear shape. It does not show s shape.
So, the assumptions are not violated.
LSD test
> Lsd.test=LSD.test(lsd.aov,"Trt")
> Lsd.test
$statistics
MSerror Df Mean CV
11.15556 9 25.5 13.09801
$parameters
test p.ajusted name.t ntr alpha
Fisher-LSD none Trt 5 0.05
$means
Yield std r se LCL UCL Min Max Q25 Q50 Q75
1 28.6 4.669047 5 1.493690 25.22104 31.97896 24 36 26.00 27.0 30.00
2 20.0 2.449490 4 1.669997 16.22221 23.77779 17 23 19.25 20.0 20.75
3 22.5 5.066228 4 1.669997 18.72221 26.27779 18 29 18.75 21.5 25.25
4 29.5 6.191392 4 1.669997 25.72221 33.27779 24 38 25.50 28.0 32.00
5 26.0 3.391165 5 1.493690 22.62104 29.37896 22 31 24.00 26.0 27.00
$comparison
NULL
$groups
Yield groups
4 29.5 a
1 28.6 a
5 26.0 ab
3 22.5 bc
2 20.0 c
attr(,"class")
[1] "group"
>
Means are ordered from highest to lowest. The mean temperature of area 4 and 1 pair has no different, while
other pairs are different.
Boxplot
Comparative Box Plot This boxplot also helped to identify the difference of the means of the
Yield in 5 treatments.
The boxplot for each treatment’s Yield indicates that treatment 4 getting
the highest Yield while treatment 2 getting the lowest and there is a
30
Yield
huge variation in the Yield all area. The mean Yield of Area 4 and 5 are
20
closely same.
1 2 3 4 5
Treatment