ANOVA
ANOVA
ANOVA
• Step 2: Calculate the total mean. This is done by adding all the means
and dividing it by the total number of means.
• Step 9: Using the f table for the specified level of significance, αα, find the
critical value. This is given by F(α, df1. df2).
#summary of analysis
summary.aov(res)
As the p-value is less than the significance level 0.05, we can conclude that there are
significant differences between the groups highlighted with “*" in the model summary.
Multiple pairwise-comparison between the
means of groups
It can be seen from the output, that only the difference between trt2 and
trt1 is significant with an adjusted p-value of 0.012.
Checking ANOVA Assumptions
• Check the homogeneity of variance
assumption
• The residuals versus fits plot can be used to check
the homogeneity of variances.
#checking homogeneity of variance
plot(res,1)
• Levene’s test
#Levene's Test
library(car)
leveneTest(weight~group,mydat)
Checking ANOVA Assumptions
(contd.)
• Check the normality assumption
• Normality plot of residuals. In this plot, the quantiles of the
residuals are plotted against the quantiles of the normal
distribution.
#checking normality
plot(res,2)
kruskal.test(weight~group,mydat)
Reference
• https://online.stat.psu.edu/stat415/lesson/13/13.2
• http://users.sussex.ac.uk/~grahamh/RM1web/F-
ratio%20table%202005.pdf
• http://www.stat.yale.edu/Courses/1997-
98/101/anovareg.htm