Can you use one-way ANOVA for three groups? Yes, you can use one-way ANOVA for three groups (or, three levels). Actually, one-way ANOVA can be used for 2 groups and more than 2 groups.
Example of one-way ANOVA for three groups
The following is a hypothetical data example for one-way ANOVA for three groups generated using R. It has the independent variable of cities, and the dependent variable of 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
R to test one-way ANOVA for three groups
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.
We can then test one-way ANOVA for the three groups in R using the combination of anova() and lm() functions in R. As we can see from the output below, F(2, 12) = 9.31, p = 0.0036.
Since the p-value is smaller than 0.05, we reject the null hypothesis (i.e., H0) and conclude that the sales in 3 different cities are significantly different.
res.aov <- anova(lm(sales~cities, data=df))
print(res.aov)
> print(res.aov) Analysis of Variance Table Response: sales Df Sum Sq Mean Sq F value Pr(>F) cities 2 1528.1 764.07 9.3103 0.003622 ** Residuals 12 984.8 82.07 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Further Reading
I also another tutorial on one-way ANOVA in SPSS (click here), and you can click to read more about it.