i

R Programming Complete Tutorial

ANOVA Test

Analysis of Variance (ANOVA) is a statistical parametric method used for comparing the datasets. In an implementation, it is similar to techniques such as z-test and t-test, where comparison of the means and the relative variance between them is used. However, ANOVA is best applied where more than two populations or samples are meant to be compared.

One-way ANOVA

One-way ANOVA is a hypothesis test that takes into account only one categorical variable or single factor. With the help of F-distribution / p-value, this helps us to compare three or more samples of the means. The Null Hypothesis (H0) represents the equity in all populations means while an Alternative hypothesis is a difference in at least one mean.

Example:

The PlantGrowth dataset contains two variables weight and group with three alternatives. We want to compare the means of the three groups. This ANOVA test concludes that as the p-value is less than the significance level, there is a significant difference among them.  


Two-way ANOVA

Two-way ANOVA examines the impact a dependent variable has on two independent variables. It also studies the inter-relationship between independent variables influencing the values of the dependent variable, if any.

Example:

The ToothGrowth Dataset contains three variables, them sup has two classes (OJ, VC), and dose has three classes (0.5, 1, 2). We will test the significance of the variables using a Two-way ANOVA test.  The result concludes that as the p values for both are less than the significance level, the variables are significant.