Two sample t-tests can validate a hypothesis containing only two groups at a time. For samples involving three or more groups, the t-test becomes tedious as you have to perform the tests for each combination of the groups. Also, Type-1 error increases in this process. You use ANOVA in such cases.
ANOVA or Analysis of Variance can determine whether the means of three or more groups are different. ANOVA uses F-tests to statistically test the equality of means.
Let’s look an example to understand how ANOVA works:
A test was conducted in a workplace, and the feedback on the three e-commerce platforms was recorded in a dataset. Following is the dataset:
Amazon | Flipkart | Snapdeal |
---|---|---|
7.5 | 7 | 5 |
8.5 | 9.5 | 7.5 |
6 | 10 | 8.5 |
10 | 6 | 3 |
8.5 | 7.5 | 6 |
8 | 8.5 | 5 |
8 | 10 | 7 |
6 | 6.5 | |
9.5 | 6.5 | |
10 | 9 | |
6.5 | 10 |
To begin with, create a null hypothesis for your ANOVA test. In this case:
3
).The process is called analysis of ‘variance’ though you are comparing ‘means’ is because the math you will use later in the process will require the concept of variance to study the means of the groups. It will tell you how the means vary or differ.
Let’s briefly summarize variance:
Variance is the average squared deviation of a data point from the distribution mean. The distance between the sample mean and each data point is measured and squared. Then, you add it together and take the average. The formula is:
Here,
You need two kinds of calculations that you have to make in accordance with the variance.
The total sum of squares, TSS is the sum of all the variations that there are, and it gives us the deviation of each observation from the grand mean of the dataset. To understand this more clearly, let’s look at your case:
Total sum of squares = Sum of squares between + Sum of squares within the group, or
, or
Total sum of squares = Sum of squares column + Sum of squares error, or
Here,
Let’s now calculate the measures for your data:
After you have calculated this data, the next step is to analyse the ANOVA table:
You have already calculated the sum of squares. Now, ‘df’ here represents the degrees of freedom.
Mean Square = Sum of squares/df
Using this formula, you can find the mean square between the groups as well as within the group. The F-statistic is simply a ratio of two variances.
To use the F-test to determine whether group means are equal, all you need to do is include the correct variances in the ratio. In one-way ANOVA, the F-statistic is given by this ratio:
Now you have to calculate the critical F-value using the F-distribution table for a given significance level and compare it with your calculated F-value. In your case, p < 0.05. The table looks like this:
Degrees of freedom of the numerator will be that of the df between the groups.
Degrees of freedom of the denominator will be that of the df within the group.
The intersection will give us the critical F-value. Now, you compare your calculated F-value with the critical F-value.
Let’s now do the final calculations in your case to see whether Amazon, Flipkart and Snapdeal are equally popular:
Your critical F-value is 3.3690
and your calculated value comes out to be 4.78
. Therefore, you will reject the null hypothesis and accept the alternate hypothesis. Therefore, Amazon, Flipkart and Snapdeal are not equally popular.