Content Reviewers:Rishi Desai, MD, MPH
Analysis of variance, or simply, ANOVA, is a type of parametric statistical test used to determine if there’s a significant difference between the means or averages of three or more groups.
And significance is normally defined by a p-value of less than 0.05 or 5%.
Now when doing any parametric test, there are three key assumptions that we have to make about the population.
First, the sample population must have been recruited randomly. Choosing names randomly ensures that the people included in the study will have similar characteristics to the target population.
This is important because that ensures that the results of the t-test can be applied to the target population - meaning it has good external validity!
The second assumption is that each individual in the sample was recruited independently from other individuals in the sample. In other words, no individuals influenced whether or not any other individual was included in the study.
For example, if two friends decided to get their blood pressures measured on the same day, and they were both included in the study, these two individuals would not be independent of each other and the second assumption would not be met.
Like random sampling, independent recruitment of individuals is important because it ensures that the sample population approximates the target population.
The third assumption is that the sample size is large enough to approximate the target population, which usually means having more than 20 people.
If it’s impossible to get a large sample size, then the sample population must follow a normal bell-shaped distribution for the characteristic being studied because that’s what we would expect to see in the target population.
Okay, now let’s say there are three medications available for lowering systolic blood pressure, and you want to figure out if any of the medications work differently than the others.
Let’s say that you find 10 people who take Medication A for 6 weeks, and that afterwards the mean systolic blood pressure for the group is 130 mmHg. Then, you find another 10 people who have been taking Medication B - and afterwards their mean systolic blood pressure is 138 mmHg, and finally you find 10 people who have been taking Medication C - and afterwards their systolic blood pressure is 132 mmHg. Now, the next step is to figure out if 130, 138, and 132 are significantly different from one another, and you do that by performing an ANOVA test.
Specifically, we would use a one-way ANOVA, because we’re looking at one independent variable - which is medication type - that has multiple levels or groups, which are Medication A, B, and C.
This is different than a multi-way ANOVA, which looks at two or more independent variables that each have multiple groups.
For example, a two-way ANOVA could compare the systolic blood pressure of older and younger people who are using different medications. In that case, the first independent variable is the medication type and the second independent variable is age category.
A third type of ANOVA test is the repeated measures ANOVA, which looks at the same group of people at multiple time periods.
For example, you could look at only people taking Medication A at 1 month, 3 months, and 6 months to see if their systolic blood pressure lowers over time. In this case, the independent variable is time, and it has three groups - the three different months - and the dependent variable is systolic blood pressure.
All ANOVA tests assume that the groups have equal variance, and variance is a measure of how spread out each individual blood pressure reading is from the group’s mean.
A large variance means that the numbers are very spread out from the mean, like if the mean blood pressure was 130 and the individual measurements included numbers like 112, 142, and 155.
A small variance means that the numbers are very close to the mean, like if the mean blood pressure was 130 and the individual measurements included numbers like 129, 131, and 135.
As a general rule, if one group has a variance that’s more than double another group’s variance, then the variance is unequal.
So, let’s say the variances for the Medication A, B, and C groups are 30, 25, and 36. Since none of the group’s variances is double another group’s, the variance is approximately equal, meaning we can go ahead and do an ANOVA test.
Typically, a one-way ANOVA test starts with two hypotheses.
The first one is the null hypothesis, and it says that the means of each group are equal.
In other words, the null hypothesis is that the mean systolic blood pressure is the same for people taking Medication A, B, or C.
The second hypothesis is the alternate hypothesis, and it says that at least one group’s mean is significantly different from the others.
So, the alternate hypothesis in our example is that the mean systolic blood pressure is not the same for people taking Medication A, B, and C.
One important thing to know is that ANOVA doesn’t tell you which group’s mean is different than the others or whether the mean is higher or lower; it simply tells you that the groups’ means are not equal.
Now, there are five steps to test these hypotheses. The first step is to calculate the mean of each individual group and the overall mean or grand mean - which is the mean blood pressure measurements for all the groups.
Since the means for each group are 138, 132, and 130, we can calculate the overall mean by adding up each group - so 138 plus 132 plus 130, which is 400. Then, we divide that by the number of groups, which is 3. So, the overall mean is 400 divided by 3, or approximately 133.
The second step is to find the between-group variation, which is also called the sum of squares-between, or the SSB.
The sum of squares-between is a measure of how similar each group’s mean is to the overall mean.
To find the sum of squares-between, we start by subtracting each group’s mean from the overall mean and squaring it, which is called the squared difference. Then, you multiply the squared difference by the number of people in that group.
So, for Medication A, we subtract the mean blood pressure of the Medication A group, which is 130, from the overall mean, which is 133, and that equals 3. The squared difference is 3 squared, or 9, and 9 times 10 - which is the number of people in the Medication A group - is 90.
For the Medication B group, the mean is 138, so 133 minus 138 is negative 5, and negative 5 squared is 25. There are 10 people in the Medication B group, so 25 times 10 is 250.
For the Medication C group, the mean is 132, so 133 minus 132 is 1, and 1 squared is still 1. There are 10 people in the Medication C group, so 1 times 10 is 10.
Now that we have the values for each group, we add them together to get the sum of squares-between. So, 90 plus 250 plus 10 is 350.
A larger sum of squares-between tells us that the group means and the overall mean are spread out or different from one another, a smaller sum of squares-between tells us that the group means are fairly similar to the overall mean.
The third step in the ANOVA calculation is to find the within-group variation, which is also called the sum of squares-within, or SSW.