# One-Way ANOVA

ANOVA is a parametric statistical technique that helps in finding out if there is a significant difference between the mean of three or more groups. It checks the impact of various factors by comparing groups (samples) on the basis of their respective mean.

**We can use this only when: **

- the samples have a normal distribution.
- the samples are selected at random and should be independent of one another.
- all groups have equal standard deviations.

**One-Way ANOVA**

It is a type of hypothesis test where only one factor is considered. We use F-statistic to perform a one-way analysis of variance.

**Steps Involved**

Step 1 -Define the null and alternative hypothesis.Hμ_{0}->_{1}= μ_{2}= μ_{3 }(where μ = mean)HAt least one difference among the means._{a}->

Step 2 -Find the degree of freedom between and within the groups.[Using Eq-1 and Eq-2]Then find total degree of freedom.[Using Eq-3]

wherek =number of groups.

wheren =number of samples in all groups combined.k =number of groups.

For the next step, we need to understand what F-statistic is.

**F-value: **It is defined as the ratio of the variance between samples to variance within samples. It is obtained while performing ANOVA test. **Eq-4 **shows the F-value formula for one-way ANOVA.

Step 3 -Refer the F-Distribution table and findFusing df_{table}_{between}and df_{within}. As per the given F-Distribution table, df_{1}= df_{between}df_{2}= df_{within}[use the given value of α while referring the table.]

Step 4 -Find the mean of all samples in each group. Then useEq-5to find the Grand mean. (μ)_{Grand}

where,∑G =sum of all sample values.n =number of samples.

Step 5 -Find the sum of squares total usingEq-6and sum of squares within usingEq-7. Then find sum of squares between usingEq-8.

where,xi_{i}=_{th}sample

where,xi_{i}=_{th}sample.μmean of i_{i}=_{th}group.

Step 6 -Find the variance (μ^{2}or S^{2}) between and within samples usingEq-9andEq-10.

Step 7 -Find Fcalc usingEq-11.

**Interpreting the results**

ifFcalc < Ftable: Don't rejct null hypothesis. μ_{1}= μ_{2}= μ_{3}ifFcalc > Ftable: Reject null hypothesis.

**Example Problem **

Consider the example given below to understand step by step how to perform this test. The marks of 3 subjects (out of 5) for a group of students is recorded. (as given in the table below)

[Take α = 0.05]

Std/Sub | English (e) | Math (m) | Science (s) |
---|---|---|---|

Student 1 | 2 | 2 | 1 |

Student 2 | 4 | 3 | 2 |

Student 3 | 2 | 4 | 5 |

Step 1 -Null hypothesis,Hμ_{0}->_{E}= μ_{M}= μ_{S}(where μ = mean) Alternate hypothesis,HAt least one difference among the means of the 3 subjects._{a}->

Step 2 -As per the table, k = 3 n = 9 df_{between}= 3 - 1 = 2[Eq-1]df_{within}= 9 - 3 = 6[Eq-2]df_{total}= 2 + 6 = 8[Eq-3]

Step 3 -On referring to the F-Distribution table (link), usingdfand_{1}= 2dfat_{2}= 6α = 0.05: we get,F_{table }= 5.14

Step 4 -μ_{e}= (2 + 4 + 2)/3=(8/3) = 2.67μ_{m}= (2 + 3 + 4)/3 = (9/3) = 3.00 μ_{s}= (1 + 2 + 5)/3 = (8/3) = 2.67 μ_{grand}= (8 + 8 + 9)/9 = (25/9) = 2.78

Step 5 -SS_{total}= (2 - 2.78)^{2 }+ (4 - 2.78)^{2}+ (2 - 2.78)^{2}+ (2 - 2.78)^{2}+ (3 - 2.78)^{2}+ (4 - 2.78)^{2}+ (1 - 2.78)^{2}+ (2 - 2.78)^{2 }+ (5 - 2.78)^{2 }=13.60SS_{within}= (2 - 2.67)^{2}+ (4 - 2.67)^{2}+ (2 - 2.67)^{2}+ (2 - 3.00)^{2}+ (3 - 3.00)^{2 }+ (4 - 3.00)^{2}+ (1 - 2.67)^{2}+ (2 - 2.67)^{2}+ (5 - 2.67)^{2}=13.34SS_{between}= 13.60 - 13.34 =0.23

Step 6 -S^{2}_{between}= (0.23/2) =0.12S^{2}_{within}= (13.34/6) =2.22

Step 7 -F_{calc}= (0.12/2.22) =0.05

Since, F_{calc}< F_{table}(0.05 < 5.14)wecannot rejectthe null hypothesis.

Thus, we can say that the means of all three subjects is the same.

One-way ANOVA compares three or more than three categorical groups to establish whether there is a difference between them. The fundamental strategy of ANOVA is to systematically examine variability within groups being compared and also examine variability among the groups being compared. For any doubt/query, comment below.

Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the **Machine Learning Foundation Course** at a student-friendly price and become industry ready.