This tutorial shows how to do the post hoc test using Fisher’s LSD (Least Significant Different) in R.
When to use Fisher’s LSD
Typically, it is when you are doing one-way ANOVA with more than 2 groups (e.g., 3 groups). Further, you should note that Fisher’s LSD is the most liberal of all post hoc tests.
What does it mean by saying that it is most liberal? Different post hoc tests use different methods to control familywise (FW) and per experiment error rate (PE). Some tests are very conservative. By being conservative, such tests go to great lengths to prevent the user from committing a type 1 error.
Although these tests buy you protection against type 1 error, it comes at a cost. As the tests become more stringent, you loose power. More liberal tests (e.g., Fisher’s LSD), on the other hand, buy you power but the cost is an increased chance of type 1 error.
According to this r-project page, Fisher’s LSD is generally not considered appropriate if you have more than 3 means. In other words, you can use Fisher’s LSD when there are 3 means, just knowing that this test is very liberal.
Data Example for Fisher’s LSD
The following is a hypothetical data example for one-way ANOVA. It has the independent variable of cities, and the dependent variable of sales.
We can fist write down the null and alternative hypotheses for one-way ANOVA for three groups as follows.
H0: Three cities does not differ in sales.
Ha: Three cities does differ in sales.
x_1= rep(c('City1','City2','City3'),each=5) sales=c(10,20,20,50,30,10,5,4,12,4,3,2,5,3,1) df <- data.frame (cities = x_1, sales=sales) print(df)
> print(df) cities sales 1 City1 10 2 City1 20 3 City1 20 4 City1 50 5 City1 30 6 City2 10 7 City2 5 8 City2 4 9 City2 12 10 City2 4 11 City3 3 12 City3 2 13 City3 5 14 City3 3 15 City3 1
Fisher’s LSD in R
We can ues the function of PostHocTest() in the R package of DescTools to do Fisher’s LSD. As we can see the comparison between City 2 and City 1 is significant (p-value = 0.0062). Further, the comparison between City 3 and City 1 is also significant (p-value = 0.0016). Finally, we can see that the comparison between City 3 and City 2 is not significant (p-value = 0.4776).
# Use DescTools package for posthoctest() library(DescTools) # construct the aov object, which will be used later model <- aov(sales ~ cities, data = df) # use posthoctest() function to do Fisher's LSD in R PostHocTest(model, method = "lsd")
> PostHocTest(model, method = "lsd") Posthoc multiple comparisons of means : Fisher LSD 95% family-wise confidence level $cities diff lwr.ci upr.ci pval City2-City1 -19.0 -31.48341 -6.516588 0.0062 ** City3-City1 -23.2 -35.68341 -10.716588 0.0016 ** City3-City2 -4.2 -16.68341 8.283412 0.4776 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Reference and Further Reading
The following page provides the explanation for the function of posthoctest() in R.
There are other packages providing different functions as well, see below.