Completely Randomized Design Analysis in R along with LSD

(Reading time 6 min.)
Click here for Data set

R-script

#Fitting of linear model
model <-lm(CRD$Yield ~ CRD$Treatment)

#Obtains R Square and other statistics of fitted model
summary <-summary(model)

#Carryout ANOVA
anova <-anova(model)
anova

#Below codes are used to obtain plots of fitted vs Residuals and Normal QQ plots
par(mfrow=c(1,2))
plot(model, which=1)
plot(model, which=2)

#Load the package
library(agricolae)

#Carry out LSD test
LSD <-LSD.test(CRD$Yield,CRD$Treatment,anova$`Df`[2],anova$`Mean Sq`[2])

#Generate the txt file of analysis
sink("crdanalysis.txt")
print("ANOVA of CRD")
print(anova)
print("LSD ANALYSIS")
print(LSD$statistics)
print(LSD$groups)
sink()


Output 

[1] "ANOVA of CRD"
Analysis of Variance Table

Response: CRD$Yield
                            Df            Sum Sq     Mean Sq         F value    Pr(>F)   
CRD$Treatment  1               220.90       220.900          19.335    0.0003477 ***
Residuals            18              205.65       11.425                     

 
[1] "LSD ANALYSIS"
  MSerror Df  Mean       CV  t.value      LSD
   11.425 18 19.85 17.02815 2.100922 5.021379
 
  CRD$Yield groups
2     25.50      a
1     21.25     ab
3     21.25     ab
4     18.00     bc
5     13.25      c

Click on the image to expand

Interpretation:

From ANOVA: The treatment source has p-value less than 0.01, so it is significant at 1 % level of significance. This means that one or more treatments means are unequal so we reject our null hypothesis of ANOVA Ho: All the five treatment means are the same. Now it's a green signal for multiple mean comparison test like LSD (least significant difference).

From LSD test: Treatment 2 has the highest mean which was at par with Treatment 1 and 3.

Love to learn by seeing instead of reading? Tune to video


If you are using "agricolae" package for analysis. You can cite it as:

Mendiburu, Felipe. (2010). Agricolae: Statistical Procedures for Agricultural Research. R package version. 1. 1-8. 

To learn more about Agricultural Statistics follow my YouTube channel

If you find this blog post and youtube video useful than please support my content. This will help me to bring more such content.


Topics you might be interested in:

Split plot analysis in R

 Degrees of freedom

Principles of designs of experiments-I: Replication

Principles of designs of experiments-II: Randomization

Comments

  1. I am very well verse by your statistical knowledge and command over subject but what amazed me is your blogging presentation and your enthusiasm to share your knowledge. Keep going.
    Regards and thanks for your help
    Miguel Acosta

    ReplyDelete
    Replies
    1. Thanks very much for your kind words. Appreciation like this motivates me to keep going!

      Delete
  2. i am also passout from FPT and i need your help in research so please give your contact details.

    ReplyDelete

Post a Comment

Popular posts from this blog

RCBD analysis in R along with LSD and DNMRT test