rstatisticsbonferroni

LSD value is null when using Bonferroni's procedure in R


I have a problem in finding the value of LSD when using the Bonferroni's procedure. It returns NULL and could you please help me with it? Thanks so much.

library(agricolae)

# Input the treatments and responses
trt <- c(rep("P", 4), rep("T", 4), rep("S", 4), rep("E", 4), rep("C",4))
response <- c(29.6, 24.3, 28.5, 32, 27.3, 32.6, 30.8, 34.8, 5.8, 6.2, 11, 8.3, 
             21.6, 17.4, 18.3, 19, 29.2, 32.8, 25, 24.2)
trt <- as.factor(trt)

df <- data.frame(trt, response)
model <- aov(response ~ trt, data = df)
out <- LSD.test(model, "trt", p.adj = "bonferroni")
out

# Obtain the LSD value
out$statistics$LSD

enter image description here


Solution

  • Unfortunately it's not very well-documented. You can check the code for LSD.test, and there you have:

       if (length(nr) == 1 & p.adj == "none") 
            statistics <- data.frame(statistics, t.value = Tprob, 
                LSD = LSD)
        if (length(nr) == 1 & p.adj != "none") 
            statistics <- data.frame(statistics, t.value = Tprob, 
                MSD = LSD)
    

    So when your p.adjust is not "none", it changes the column name to MSD which means minimum significant difference. You can also switch to console (option console =TRUE) to see this.