You are on page 1of 2

Monika Piwowar

mpiwowar@cm-uj.krakow.pl

ANOVA - theory

An ANOVA is a statistical test that is used to determine whether or not there is a statistically
significant difference between the means of three or more independent groups.

1. Hypothesis

The hypotheses used in an ANOVA are as follows:

The null hypothesis (H0): µ1 = µ2 = µ3 = … = µk (the means are equal for each group)
or all population means are equal

The alternative hypothesis (Ha): at least one of the means is different from the
others or at least one population mean is different from the rest.

2. Objectivity conditions

singificance level α=0.05

Assumption of ANOVA:
• The response is normally distributed
• Variance is similar within different groups
• The data points are independent

3. Final decision
• p < α: H0 rejected, H1 accepted. There are statistically significant differences between
means among groups.
• p > α: H0 We end up with no conclusion.

How to do it in R
# ANOVA test (independent more then two groups)

Fit <- (y~x, data = data) # where y is numeric and x is a binary factor
summary (fit)
Monika Piwowar
mpiwowar@cm-uj.krakow.pl

If the p-value from the ANOVA is less than the significance level, we can reject the null
hypothesis and conclude that we have sufficient evidence to say that at least one of the means
of the groups is different from the others.

However, this doesn’t tell us which groups are different from each other. It simply tells us that
not all of the group means are equal.

In order to find out exactly which groups are different from each other, we must conduct
a post hoc test (also known as a multiple comparison test), which will allow us to explore the
difference between multiple group means while also controlling for the family-wise error rate.

How to do it in R
# POST HOC test (after ANOVA)

pairwise.t.test(y,x, p.adj = "bonf") # where y is numeric and x is a binary factor

You might also like