# dataset data <- data.frame( group = rep(c("A", "B", "C"), each = 5), value = c(254, 263, 241, 237, 251, 234, 218, 235, 227, 216, 200, 222, 197, 206, 204 ) ) print(data) # ANOVA oneway anova_mod <- aov(value ~ group, data = data) summary(anova_mod) # critical value F # qf(1 - alpha, df1, df2) alpha=0.05 qf(1 - alpha, 2, 12) # Conclusions: 25.27 > 3.88 (Reject Ho) # Test normality of the residuals shapiro.test(residuals(anova_mod)) # (H???): data (or residuals) normally distributed # (H???): data (or residuals) not normally distributed # pval > alpha --> accept Ho ; pval < alpha --> reject Ho # Omogeneity of the variances bartlett.test(value ~ group, data = data) # H???: all the variances are equal # H1: not all the variances are equal # pval > alpha --> accept Ho ; pval < alpha --> reject Ho # figure with group means and conf intervals boxplot(value ~ group, data = data, main = "ANOVA", xlab = "Group", ylab = "Value", col = c("lightblue", "lightgreen", "lightpink")) mean_overall <- mean(data$value) # Add orizontal line for grand mean abline(h = mean_overall, col = "red", lwd = 2, lty = 2) # post ANOVA --> HSD test ??? Honest Significant Difference tukey.one.way<-TukeyHSD(anova_mod) tukey.one.way # interpretation of HSD results # if confidence interval include the value 0 --> the difference is not statistically significative # if p-vakue < 0.05, the difference is statistically significative # conclusion: the mean differences between all the pairs of group is statistically significant