Pranjali Parnerkar
4 min readOct 11, 2020

ANALYSIS OF VARIANCE (ANOVA)

ANOVA is a statistical method used for hypothesis testing where we want to compare the means of more than two groups simultaneously created using a factor (or factors). Since the inferences about mean are made by analyzing the variance hence the name Analysis of Variance (ANOVA).

Let’s understand ANOVA by considering an example where we want to study the impact of different levels of price discount on sales of Nike shoes. Assume that the levels of discounts are 0%, 15% and 25%. So our data will be divided into three groups of 0%, 15% and 25% discount.

To understand the impact on average sales quantity of shoes, we will compare the population parameter of all the three groups. Now the question might arise as why can’t we use t-test instead of ANOVA to compare the population parameter of different groups? Using ANOVA or t-test for two independent groups would give the same result but for more than two groups t-test is inappropriate since it would affect the desired level of significance and the Type-I and Type-II errors will be estimated incorrectly.

Back to our example, let’s take a sample of quantity of shoes sold with 0%, 15% and 25% discounts on randomly selected days.

ONE-WAY ANALYSIS OF VARIANCE

One-way analysis of variance is appropriate under the following conditions:

1. We would like to study the impact of a single treatment (factor) at different levels (groups) on a continuous response variable.

2. In each group, the population response variable follows a normal distribution and sample are chosen using random sampling.

3. The population variances for different groups are assumed to be the same. That is, the variability in the response variable values within different groups is same.

The null and alternate hypothesis for the impact of a factor (product discount) with k-levels on a continuous variable (sales quantity) are given by

H0 : µ1 = µ2 = µ3 ………………………. = µk

Ha : Not all µ are equal or at least one mean differs from others

Considering our example,

H0 : µ0 = µ15 = µ25

Ha : Not all µ are equal or at least one mean differs from others

K (number of groups) = 3

n (total number of observations) = 15

ni = number of observation in group i

Yij = observation j in group i and

µi = mean of the group i

To arrive at the statistic, we calculate the following measures, which are variations within group and between groups.

1. Sum of Squares of Between Group Variations (SSB)

µ0 = 20/5 = 4, µ15 = 40/5 = 8, µ25 = 65/5 = 13

µ (grand mean)= 8.3

SSB = 5 x [(4–8.3)^2 + (8–8.3)^2 + (13–8.3)^2]

SSB = 5 x (18.49 + 0.09 + 22.09)

SSB = 203.35

The degree of freedom for SSB is (k-1) and mean square variation (MSB) is given by

MSB = 203.35 / 2

MSB = 101.67

2. Sum of Squares of Within Group Variations (SSW)

SSW = 22 + 18 + 14

SSW = 54

The degree of freedom for SSW is (n-k) and mean square of variation within the group is

MSW = 54 / (15–3)

MSW = 4.5

If the null hypothesis is true, then there will be no difference in the mean values which will result in no difference between MSB and MSW. Alternatively, if the means are different, then MSB will be larger than MSW. That is the ratio MSB/MSW will be close to 1 if there is no difference between the mean values and larger than 1 if the means are different. MSB/MSW is a ratio of two chi-square variate which is an F-distribution. Thus, the statistic for testing the null hypothesis is

F (2, 12) = 101.6/4.5 = 22.57

So referring the table, the critical F-value with degree of freedom (2,12) for α = 0.05 is 3.89. Since the calculated F-statistics is much higher than the critical F-value, we reject the null hypothesis and conclude that the mean sales quantity of Nike shoes under different discounts are different.

Hope this post was helpful!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Pranjali Parnerkar
Pranjali Parnerkar

Written by Pranjali Parnerkar

Data Scientist | Computer Science Engineer

No responses yet

Write a response