What is ANOVA?

Eric Lee
4 min readApr 15, 2020

--

Description

ANOVA is the acronym for “Analysis of Variance”. Here we will focus on Single Factor ANOVA.

For example, if you want to know whether a statistically significant difference exists between multiple categories, then you would use ANOVA.

Generic Example

Let’s say you have variables 1, 2, & 3. You would state your null hypothesis as the following.

This null hypothesis states that there is no statistically significant difference between the means of variable 1, 2, & 3.

You could do this up to n variables.

Real-life Example

We want to know if a difference exists between three grades. Grades 6, 7, & 8.

This is single factor ANOVA because these grades are from the same middle school. In other words, each grade is a subcategory of the parent category, middle school.

Run ANOVA

Calculate the F-statistic

Purpose: The F-statistic will determine whether a statistically significant difference exists between the categories.

How: Calculate the the ratio between the variability among the category sample means and the variability within each category distribution.

If the F-statistic is high, then we are more likely to reject the null hypothesis because this means that the variability between the means is relatively large compared to the variance within the standard deviations.

Math:

Let’s start off by labeling some variables.

N = # of total observations

C = # of categories

The following section will use the middle school example from above.

C = 3

For each grade, let’s say we take 100 observations.

N = 3 * 100 = 300

The F-statistic is a ratio between the mean-squared of categories (MSC) and the mean-squared of the errors (MSE).

SSC = Sum of squares (of categories)

SSE = Sum of squares (of error)

df = degrees of freedom

For SSC, n = 2 since i starts at 0. One for each category mean. If grade 6, 7, & 8 category means were 70, 71, & 72 respectively, then we would have

SSC = (70–71)² +(71–71)²+(72–71)²

Manual calculation for SSE would be a bit more tedious since we need to take the Sum of Squares error for each category then add them together.

Degrees of freedom for c would be C-1 = 3–1 = 2.

Degrees of freedom for e would be N-C = 300–3 = 273.

Accept or Reject NULL Hypothesis

Once we find the F-statistic, we also need to calculate the critical-value of F which is based off the p-value, C and N. If we find that the F-statistic is less than the critical value, we fail to reject the null hypothesis i.e. there is no statistically significant difference between the data for each category.

Follow-up with T-test

Purpose: To find where the differences exists.

How: Conduct a t-test for every unique pair of categories to determine the difference between each pair.

“Why not just do t-tests for all pairs of variables?”

If we’re eventually going to conduct t-tests, why not start and finish with them.

The answer is that the Type I Error rate compounds.

Let’s say say that you take a t-test for 3 variables. This means there are 3 unique pairs.

Since the alpha is 0.05 for each t-test, the overall Type I Error rate becomes

(1–0.95³) = (1–0.857) = 14.3%

Assumptions

Just as in most statistical tests, there are key assumptions that may affect the validity and interpretation of the test results. Here are the assumptions for ANOVA.

  1. Random and normal distribution
  2. Homogeneity of variance
  3. Independent observations

--

--

Eric Lee
Eric Lee

Written by Eric Lee

Data Analytics/Science/Intelligence

No responses yet