What is ANOVA?

Analysis of Variance (ANOVA) in R is used to compare mean between two or more items. It’s a statistical method that yields values that can be tested to determine whether a significant relation exists between variables.

Example:

A car company wishes to compare the average petrol consumption of three similar models of cars and has six vehicles available for each model. It follows a 6×3 matrix, columns have cars and rows have models. Here, we compare the average petrol consumption.

A teacher is interested in comparing the average percentage marks attained in the examinations of five different subjects and the marks are available for eight students, who have completed each examination. If the teacher wants to compare the mean average % of marks between all students of five different subjects, for comparing the mean between two entities we use Analysis of Variance.

Taking the example of cars, here we assume there are 3 car models: Car A, Car B and Car C. Car A has 6 rows, Car B has 6 rows and Car C has 6 rows. First, we calculate the mean of all groups combined known as the overall mean. Then it calculates, within each group, the total deviation of each individual’s score from the Group Mean –within Group Variation. Next, it calculates the division of each group mean from the overall mean known as between group variation. In ANOVA, we calculate two group variations which is the overall mean (average of 18 cars) and then it calculates the total deviation of each individual score from the group mean.

Now, it calculates the deviation of each Group Mean from the Overall Mean (Between Group Variation). ANOVA then uses the F-Test which compares the ‘between group variation’ with the ‘within group variation’ and then based on the F test values, it concludes whether the average of all models are supposed to be equal or different.

Two-way Analysis of Variance

Let’s take an example of a case which has elements such as Observation, Gender, Dosage with 16 observations of each. They all must be numerical since mean and variance is being used.

Here in Gender, we have to convert into dummy variable which involves assigning numbers like 1 and O for male and female. But LSS of variance can only be applied on quantitative data.

ANOVA is a particular form of statistical hypothesis test heavily used in the analysis of experiment data. A statistical hypothesis test is a method of making decision using data. A test result (calculated from the null hypothesis and the sample) is called statistically significant if it is deemed unlikely to have occurred by chance, assuming the truth of the null hypothesis. A statistically significant result, when a probability (p-value) is less than a threshold (significance level), justifies the rejection of the null hypothesis but only if the prior probability of the null hypothesis is not high.

One-way Analysis of Variance

The above table has elements such as Df & Sum Sq which are an integral part of the One-way Analysis of Variance.

Df(Degree of Freedom) – In a statistical point of view, let’s say data is end point with no statistical constraints. Here, the Degree of Freedom is N. When mean of N data is 1,000, the degree of freedom would be N-1. If there are more statistical constraints then degree of freedom will be N-2 and so on.

Sum Sq (Sum of Square)– It’s a way of calculating variation. When we talk about variation, it’s always calculated between value and mean.

ANOVA is a synthesis of several ideas and is used for multiple purposes. As a consequence, it is difficult to define concisely or precisely. It is used in logistic regression as well. It’s not only used for calculating mean but also checking the different model performance. F-Test is used to compare the variation between the explained variance and unexplained variance. In ANOVA, we take the F-Test based on the within group variation to between group variation.

Got a question for us?? Mention them in the comments section and we will get back to you.