Statology

Statistics Made Easy

One-Way ANOVA: Definition, Formula, and Example

A one-way ANOVA  (“analysis of variance”) compares the means of three or more independent groups to determine if there is a statistically significant difference between the corresponding population means.

This tutorial explains the following:

  • The motivation for performing a one-way ANOVA.
  • The assumptions that should be met to perform a one-way ANOVA.
  • The process to perform a one-way ANOVA.
  • An example of how to perform a one-way ANOVA.

One-Way ANOVA: Motivation

Suppose we want to know whether or not three different exam prep programs lead to different mean scores on a college entrance exam. Since there are millions of high school students around the country, it would be too time-consuming and costly to go around to each student and let them use one of the exam prep programs.

Instead, we might select three  random samples  of 100 students from the population and allow each sample to use one of the three test prep programs to prepare for the exam. Then, we could record the scores for each student once they take the exam.

Selecting samples from a population

However, it’s virtually guaranteed that the mean exam score between the three samples will be at least a little different.  The question is whether or not this difference is statistically significant . Fortunately, a one-way ANOVA allows us to answer this question.

One-Way ANOVA: Assumptions

For the results of a one-way ANOVA to be valid, the following assumptions should be met:

1. Normality  – Each sample was drawn from a normally distributed population.

2. Equal Variances  – The variances of the populations that the samples come from are equal. You can use Bartlett’s Test to verify this assumption.

3. Independence  – The observations in each group are independent of each other and the observations within groups were obtained by a random sample.

Read this article for in-depth details on how to check these assumptions.

One-Way ANOVA: The Process

A one-way ANOVA uses the following null and alternative hypotheses:

  • H 0 (null hypothesis):  μ 1  = μ 2  = μ 3  = … = μ k  (all the population means are equal)
  • H 1  (alternative hypothesis):  at least one population mean is different   from the rest

You will typically use some statistical software (such as R, Excel, Stata, SPSS, etc.) to perform a one-way ANOVA since it’s cumbersome to perform by hand.

No matter which software you use, you will receive the following table as output:

  • SSR: regression sum of squares
  • SSE: error sum of squares
  • SST: total sum of squares (SST = SSR + SSE)
  • df r : regression degrees of freedom (df r  = k-1)
  • df e : error degrees of freedom (df e  = n-k)
  • k:  total number of groups
  • n:  total observations
  • MSR:  regression mean square (MSR = SSR/df r )
  • MSE: error mean square (MSE = SSE/df e )
  • F:  The F test statistic (F = MSR/MSE)
  • p:  The p-value that corresponds to F dfr, dfe

If the p-value is less than your chosen significance level (e.g. 0.05), then you can reject the null hypothesis and conclude that at least one of the population means is different from the others.

Note: If you reject the null hypothesis, this indicates that at least one of the population means is different from the others, but the ANOVA table doesn’t specify which  population means are different. To determine this, you need to perform post hoc tests , also known as “multiple comparisons” tests.

One-Way ANOVA: Example

Suppose we want to know whether or not three different exam prep programs lead to different mean scores on a certain exam. To test this, we recruit 30 students to participate in a study and split them into three groups.

The students in each group are randomly assigned to use one of the three exam prep programs for the next three weeks to prepare for an exam. At the end of the three weeks, all of the students take the same exam. 

The exam scores for each group are shown below:

Example one-way ANOVA data

To perform a one-way ANOVA on this data, we will use the Statology One-Way ANOVA Calculator with the following input:

One-way ANOVA calculation example

From the output table we see that the F test statistic is  2.358  and the corresponding p-value is  0.11385 .

ANOVA output table interpretation

Since this p-value is not less than 0.05, we fail to reject the null hypothesis.

This means  we don’t have sufficient evidence to say that there is a statistically significant difference between the mean exam scores of the three groups.

Additional Resources

The following articles explain how to perform a one-way ANOVA using different statistical softwares:

How to Perform a One-Way ANOVA in Excel How to Perform a One-Way ANOVA in R How to Perform a One-Way ANOVA in Python How to Perform a One-Way ANOVA in SAS How to Perform a One-Way ANOVA in SPSS How to Perform a One-Way ANOVA in Stata How to Perform a One-Way ANOVA on a TI-84 Calculator Online One-Way ANOVA Calculator

Featured Posts

5 Regularization Techniques You Should Know

Hey there. My name is Zach Bobbitt. I have a Masters of Science degree in Applied Statistics and I’ve worked on machine learning algorithms for professional businesses in both healthcare and retail. I’m passionate about statistics, machine learning, and data visualization and I created Statology to be a resource for both students and teachers alike.  My goal with this site is to help you learn statistics through using simple terms, plenty of real-world examples, and helpful illustrations.

2 Replies to “One-Way ANOVA: Definition, Formula, and Example”

Zach how do I cite something from Statology? I am using it for my dissertation.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join the Statology Community

Sign up to receive Statology's exclusive study resource: 100 practice problems with step-by-step solutions. Plus, get our latest insights, tutorials, and data analysis tips straight to your inbox!

By subscribing you accept Statology's Privacy Policy.

JMP | Statistical Discovery.™ From SAS.

Statistics Knowledge Portal

A free online introduction to statistics

One-Way ANOVA

What is one-way anova.

One-way analysis of variance (ANOVA) is a statistical method for testing for differences in the means of three or more groups.

How is one-way ANOVA used?

One-way ANOVA is typically used when you have a single independent variable, or factor , and your goal is to investigate if variations, or different levels  of that factor have a measurable effect on a dependent variable.

What are some limitations to consider?

One-way ANOVA can only be used when investigating a single factor and a single dependent variable. When comparing the means of three or more groups, it can tell us if at least one pair of means is significantly different, but it can’t tell us which pair. Also, it requires that the dependent variable be normally distributed in each of the groups and that the variability within groups is similar across groups.

One-way ANOVA is a test for differences in group means

See how to perform a one-way anova using statistical software.

  • Download JMP to follow along using the sample data included with the software.
  • To see more JMP tutorials, visit the JMP Learning Library .

One-way ANOVA is a statistical method to test the null hypothesis ( H 0 ) that three or more population means are equal vs. the alternative hypothesis ( H a ) that at least one mean is different. Using the formal notation of statistical hypotheses, for k means we write:

$ H_0:\mu_1=\mu_2=\cdots=\mu_k $

$ H_a:\mathrm{not\mathrm{\ }all\ means\ are\ equal} $

where $\mu_i$ is the mean of the i -th level of the factor.

Okay, you might be thinking, but in what situations would I need to determine if the means of multiple populations are the same or different? A common scenario is you suspect that a particular independent process variable is a driver of an important result of that process. For example, you may have suspicions about how different production lots, operators or raw material batches are affecting the output (aka a quality measurement) of a production process.

To test your suspicion, you could run the process using three or more variations (aka levels) of this independent variable (aka factor), and then take a sample of observations from the results of each run. If you find differences when comparing the means from each group of observations using an ANOVA, then (assuming you’ve done everything correctly!) you have evidence that your suspicion was correct—the factor you investigated appears to play a role in the result!

A one-way ANOVA example

Let's work through a one-way ANOVA example in more detail. Imagine you work for a company that manufactures an adhesive gel that is sold in small jars. The viscosity of the gel is important: too thick and it becomes difficult to apply; too thin and its adhesiveness suffers. You've received some feedback from a few unhappy customers lately complaining that the viscosity of your adhesive is not as consistent as it used to be. You've been asked by your boss to investigate.

You decide that a good first step would be to examine the average viscosity of the five most recent production lots. If you find differences between lots, that would seem to confirm the issue is real. It might also help you begin to form hypotheses about factors that could cause inconsistencies between lots.

You measure viscosity using an instrument that rotates a spindle immersed in the jar of adhesive. This test yields a measurement called torque resistance. You test five jars selected randomly from each of the most recent five lots. You obtain the torque resistance measurement for each jar and plot the data.

explain the hypothesis testing using one way of anova

From the plot of the data, you observe that torque measurements from the Lot 3 jars tend to be lower than the torque measurements from the samples taken from the other lots. When you calculate the means from all your measurements, you see that the mean torque for Lot 3 is 26.77—much lower than the other four lots, each with a mean of around 30.

Table 1: Mean torque measurements from tests of five lots of adhesive

The anova table.

ANOVA results are typically displayed in an ANOVA table. An ANOVA table includes:

  • Source: the sources of variation including the factor being examined (in our case, lot), error and total.
  • DF: degrees of freedom for each source of variation.
  • Sum of Squares: sum of squares (SS) for each source of variation along with the total from all sources.
  • Mean Square: sum of squares divided by its associated degrees of freedom.
  • F Ratio: the mean square of the factor (lot) divided by the mean square of the error.
  • Prob > F: the p-value.

Table 2: ANOVA table with results from our torque measurements

We'll explain how the components of this table are derived below. One key element in this table to focus on for now is the p-value. The p-value is used to evaluate the validity of the null hypothesis that all the means are the same. In our example, the p-value (Prob > F) is 0.0012. This small p-value can be taken as evidence that the means are not all the same. Our samples provide evidence that there is a difference in the average torque resistance values between one or more of the five lots.

What is a p-value?

A p-value is a measure of probability used for hypothesis testing. The goal of hypothesis testing is to determine whether there is enough evidence to support a certain hypothesis about your data. Recall that with ANOVA, we formulate two hypotheses: the null hypothesis that all the means are equal and the alternative hypothesis that the means are not all equal.

Because we’re only examining random samples of data pulled from whole populations, there’s a risk that the means of our samples are not representative of the means of the full populations. The p-value gives us a way to quantify that risk. It is the probability that any variability in the means of your sample data is the result of pure chance; more specifically, it’s the probability of observing variances in the sample means at least as large as what you’ve measured when in fact the null hypothesis is true (the full population means are, in fact, equal).

A small p-value would lead you to reject the null hypothesis. A typical threshold for rejection of a null hypothesis is 0.05. That is, if you have a p-value less than 0.05, you would reject the null hypothesis in favor of the alternative hypothesis that at least one mean is different from the rest.

Based on these results, you decide to hold Lot 3 for further testing. In your report you might write: The torque from five jars of product were measured from each of the five most recent production lots. An ANOVA analysis found that the observations support a difference in mean torque between lots (p = 0.0012). A plot of the data shows that Lot 3 had a lower mean (26.77) torque as compared to the other four lots. We will hold Lot 3 for further evaluation.

Remember, an ANOVA test will not tell you which mean or means differs from the others, and (unlike our example) this isn't always obvious from a plot of the data. One way to answer questions about specific types of differences is to use a multiple comparison test. For example, to compare group means to the overall mean, you can use analysis of means (ANOM). To compare individual pairs of means, you can use the Tukey-Kramer multiple comparison test.

One-way ANOVA calculation

Now let’s consider our torque measurement example in more detail. Recall that we had five lots of material. From each lot we randomly selected five jars for testing. This is called a one-factor design. The one factor, lot, has five levels. Each level is replicated (tested) five times. The results of the testing are listed below.

Table 3: Torque measurements by Lot

To explore the calculations that resulted in the ANOVA table above (Table 2), let's first establish the following definitions:

$n_i$ = Number of observations for treatment $i$ (in our example, Lot $i$)

$N$ = Total number of observations

$Y_{ij}$ = The j th observation on the i th treatment

$\overline{Y}_i$ = The sample mean for the i th treatment

$\overline{\overline{Y}}$ = The mean of all observations (grand mean)

Sum of Squares

With these definitions in mind, let's tackle the Sum of Squares column from the ANOVA table. The sum of squares gives us a way to quantify variability in a data set by focusing on the difference between each data point and the mean of all data points in that data set. The formula below partitions the overall variability into two parts: the variability due to the model or the factor levels, and the variability due to random error.  

$$ \sum_{i=1}^{a}\sum_{j=1}^{n_i}(Y_{ij}-\overline{\overline{Y}})^2\;=\;\sum_{i=1}^{a}n_i(\overline{Y}_i-\overline{\overline{Y}})^2+\sum_{i=1}^{a}\sum_{j=1}^{n_i}(Y_{ij}-\overline{Y}_i)^2 $$

$$ SS(Total)\;     =     \;SS(Factor)\;     +     \;SS(Error) $$

While that equation may seem complicated, focusing on each element individually makes it much easier to grasp. Table 4 below lists each component of the formula and then builds them into the squared terms that make up the sum of squares. The first column of data ($Y_{ij}$) contains the torque measurements we gathered in Table 3 above.

Another way to look at sources of variability: between group variation and within group variation

Recall that in our ANOVA table above (Table 2), the Source column lists two sources of variation: factor (in our example, lot) and error. Another way to think of those two sources is between group variation (which corresponds to variation due to the factor or treatment) and within group variation (which corresponds to variation due to chance or error). So using that terminology, our sum of squares formula is essentially calculating the sum of variation due to differences between the groups (the treatment effect) and variation due to differences within each group (unexplained differences due to chance).  

Table 4: Sum of squares calculation

Degrees of freedom (df).

Associated with each sum of squares is a quantity called degrees of freedom (DF). The degrees of freedom indicate the number of independent pieces of information used to calculate each sum of squares. For a one factor design with a factor at k levels (five lots in our example) and a total of N observations (five jars per lot for a total of 25), the degrees of freedom are as follows:

Table 5: Determining degrees of freedom

Mean squares (ms) and f ratio.

We divide each sum of squares by the corresponding degrees of freedom to obtain mean squares. When the null hypothesis is true (i.e. the means are equal), MS (Factor) and MS (Error) are both estimates of error variance and would be about the same size. Their ratio, or the F ratio, would be close to one. When the null hypothesis is not true then the MS (Factor) will be larger than MS (Error) and their ratio greater than 1. In our adhesive testing example, the computed F ratio, 6.90, presents significant evidence against the null hypothesis that the means are equal.

Table 6: Calculating mean squares and F ratio

The ratio of MS(factor) to MS(error)—the F ratio—has an F distribution. The F distribution is the distribution of F values that we'd expect to observe when the null hypothesis is true (i.e. the means are equal). F distributions have different shapes based on two parameters, called the numerator and denominator degrees of freedom. For an ANOVA test, the numerator is the MS(factor), so the degrees of freedom are those associated with the MS(factor). The denominator is the MS(error), so the denominator degrees of freedom are those associated with the MS(error).

If your computed F ratio exceeds the expected value from the corresponding F distribution, then, assuming a sufficiently small p-value, you would reject the null hypothesis that the means are equal. The p-value in this case is the probability of observing a value greater than the F ratio from the F distribution when in fact the null hypothesis is true.

explain the hypothesis testing using one way of anova

Module 13: F-Distribution and One-Way ANOVA

One-way anova, learning outcomes.

  • Conduct and interpret one-way ANOVA

The purpose of a one-way ANOVA test is to determine the existence of a statistically significant difference among several group means. The test actually uses variances to help determine if the means are equal or not. In order to perform a one-way ANOVA test, there are five basic assumptions to be fulfilled:

  • Each population from which a sample is taken is assumed to be normal.
  • All samples are randomly selected and independent.
  • The populations are assumed to have equal standard deviations (or variances) .
  • The factor is a categorical variable.
  • The response is a numerical variable.

The Null and Alternative Hypotheses

The null hypothesis is simply that all the group population means are the same. The alternative hypothesis is that at least one pair of means is different. For example, if there are k groups:

H 0 : μ 1 = μ 2 = μ 3 = … = μ k

H a : At least two of the group means μ 1 , μ 2 , μ 3 , …, μ k are not equal.

The graphs, a set of box plots representing the distribution of values with the group means indicated by a horizontal line through the box, help in the understanding of the hypothesis test. In the first graph (red box plots), H 0 : μ 1 = μ 2 = μ 3 and the three populations have the same distribution if the null hypothesis is true. The variance of the combined data is approximately the same as the variance of each of the populations.

If the null hypothesis is false, then the variance of the combined data is larger which is caused by the different means as shown in the second graph (green box plots).

The first illustration shows three vertical boxplots with equal means. The second illustration shows three vertical boxplots with unequal means.

(b) H 0 is not true. All means are not the same; the differences are too large to be due to random variation.

Concept Review

Analysis of variance extends the comparison of two groups to several, each a level of a categorical variable (factor). Samples from each group are independent, and must be randomly selected from normal populations with equal variances. We test the null hypothesis of equal means of the response in every group versus the alternative hypothesis of one or more group means being different from the others. A one-way ANOVA hypothesis test determines if several population means are equal. The distribution for the test is the F distribution with two different degrees of freedom.

Assumptions:

  • The populations are assumed to have equal standard deviations (or variances).
  • OpenStax, Statistics, One-Way ANOVA. Located at : http://cnx.org/contents/[email protected] . License : CC BY: Attribution
  • Introductory Statistics . Authored by : Barbara Illowski, Susan Dean. Provided by : Open Stax. Located at : http://cnx.org/contents/[email protected] . License : CC BY: Attribution . License Terms : Download for free at http://cnx.org/contents/[email protected]
  • Completing a simple ANOVA table. Authored by : masterskills. Located at : https://youtu.be/OXA-bw9tGfo . License : All Rights Reserved . License Terms : Standard YouTube License

10: One-Way ANOVA

  • Explain why it is not appropriate to conduct multiple independent t tests to compare the means of more than two independent groups
  • Use Minitab to construct a probability plot for an F distribution
  • Use Minitab to perform a one-way between groups ANOVA with Tukey's pairwise comparisons
  • Interpret the results of a one-way between groups ANOVA
  • Interpret the results of Tukey's pairwise comparisons

In previous lessons you learned how to compare the means of two independent groups. In this lesson, we will learn how to compare the means of more than two independent groups. This procedure is known as a one-way between groups analysis of variance, or more often as a "one-way ANOVA."

Why not multiple independent t-tests?

A frequently asked question is, "why not just perform multiple two independent samples \(t\) tests?" If you were to perform multiple independent \(t\) tests instead of a one-way between groups ANOVA you would need to perform more tests. For \(k\) independent groups there are \(\frac{k(k-1)}{2}\) possible pairs. If you had 5 independent groups, that would equal \(\frac{5(5-1)}{2}=10\) independent t tests! And, those 10 independent t tests would not give you information about the independent variable overall. Most importantly, multiple \(t\) tests would lead to a greater chance of making a Type I error. By using an ANOVA, you avoid inflating \(\alpha\) and you avoid increasing the likelihood of a Type I error.

10.1 - Introduction to the F Distribution

One-way ANOVAs, along with a number of other statistical tests, use the F distribution. Earlier in this course you learned about the \(z\) and \(t\) distributions. You computed \(z\) and \(t\) test statistics and used those values to look up p-values using statistical software. Similarly, in this lesson you are going to compute F test statistics. The F test statistic can be used to determine the p-value for a one-way ANOVA.

The video below gives a brief introduction to the F distribution and walks you through two examples of using Minitab to find the p-values for given F test statistics. The steps for creating a distribution plot to find the area under the F distribution are the same as the steps for finding the area under the \(z\) or \(t\) distribution. For the F distribution we will always be looking for a right-tailed probability. Later in this lesson we will see that this area is the p-value.

The F distribution has two different degrees of freedom: between groups and within groups. Minitab will call these the numerator and denominator degrees of freedom, respectively. Within groups is also referred to as error. 

\(df_{between}=k-1\)

\(k\) = number of groups

\(df_{within}=n-k\)

\(n\) = total sample size with all groups combined

Minitab ®  – Creating an F Distribution

Scenario:  An F test statistic of 2.57 is computed with 3 and 246 degrees of freedom. What is the p-value for this test?

We can create a distribution plot. Our distribution is the F distribution. The numerator df (\(df_1\)) is 3 and the denominator df (\(df_2\)) is 246. We want to shade the area in the right tail. Our “X Value” is 2.57.

  • Open Minitab
  • Select Graph > Probability Distribution Plot > View Probability
  • Change the Distribution to  F
  • Fill in the  Numerator degrees of freedom  with 3 and the  Denominator degrees of freedom  with 246
  • Select the Options button
  • Select  A specified x value
  • Use the default  Right tail 
  • For the  X value  enter 2.57

Distribution Plot of Density vs X - Fm df1=3, df2=246

The area beyond an F-value of 2.57 with 3 and 246 degrees of freedom is 0.05487. The p-value for this F test is 0.05487.

Note : When you conduct an ANOVA in Minitab, the software will compute this p-value for you.

10.2 - Hypothesis Testing

A one-way between groups ANOVA is used to compare the means of more than two independent groups. A one-way between groups ANOVA comparing just two groups will give you the same results at the independent \(t\) test that you conducted in Lesson 8 . We will use the five step hypothesis testing procedure again in this lesson.

The assumptions for a one-way between groups ANOVA are:

  • Samples are independent
  • The response variable is approximately normally distributed for each group or all group sample sizes are at least 30
  • The population variances are equal across responses for the group levels (if the largest sample standard deviation divided by the smallest sample standard deviation is  not  greater than  two , then assume that the population variances are equal)

Given that you are comparing \(k\) independent groups, the null and alternative hypotheses are:

\(H_{0}: \mu_1 = \mu_2 = \cdots = \mu_k\) \(H_{a}:\) Not all \(\mu_\cdot\) are equal

In other words, the null hypothesis is that at all of the groups' population means are equal. The alternative is that they are not all equal; there are at least two population means that are not equal to one another.

ANOVA uses an F test statistic. Hand calculations for ANOVAs require many steps. In this class, you will be working primarily with Minitab outputs.

Conceptually, the F statistic is a ratio: \(F=\frac{Between\;groups\;variability}{Within\;groups\;variability}\). Numerically this translates to \(F=\frac{MS_{Between}}{MS_{Within}}\). In other words how much do individuals in different groups vary from one another over how much to individuals within groups vary from one another.

Statistical software will compute the F ratio for you and produce what is known as an ANOVA source table. The ANOVA source table will give you information about the variability between groups and within groups. The table below gives you all of the formulas, but you will not be responsible for performing these calculations by hand. Minitab will do all of these calculations for you and provide you with the full ANOVA source table.

Some of the terms in the table above should look familiar, while others will be new to you. The sum of squares that appears in the ANOVA source table is similar to the sum of squares that you computed in Lesson 2 when computing variance and standard deviation. Recall, the sum of squares is the squared difference between each score and the mean. Here, there are three different sum of squares each measuring a different type of variability.

The ANOVA source table also has three different degrees of freedom: \(df_{between}\), \(df_{within}\), and \(df_{total}\). If you were to look up an F value using statistical software you would need to know two of these degrees of freedom: \(df_1 = df_{between}\) and \(df_2=df_{within}\).

When performing an  ANOVA using statistical software, you will be given the p-value in the ANOVA source table. If performing an ANOVA by hand, you would use the F distribution. Similar to the t distribution, the F distribution varies depending on degrees of freedom.

If \(p \leq \alpha\) reject the null hypothesis. If \(p>\alpha\) fail to reject the null hypothesis.

Based on your decision in Step 4 , write a conclusion in terms of the original research question.

10.3 - Pairwise Comparisons

While the results of a one-way between groups ANOVA will tell you if there is what is known as a main effect of the explanatory variable, the initial results will not tell you which groups are different from one another. In order to determine which groups are different from one another, a post-hoc test is needed. Post-hoc tests are conducted after an ANOVA to determine which groups differ from one another. There are many different post-hoc analyses that could be performed following an ANOVA. Here, we will learn about one of the most common tests known as Tukey's Honestly Significant Differences (HSD) Test.

Most statistical software, including Minitab, will compute Tukey's pairwise comparisons for you. This specific post-hoc test makes all possible pairwise comparisons. In this class we will be relying on statistical software to perform these analyses, if you are interested in seeing how the calculations are performed, this information is contained in the notes for STAT 502: Analysis of Variance and Design of Experiments. This analysis takes into account the fact that multiple tests are being performed and makes the necessary adjustments to ensure that Type I error is not inflated.

In the examples later in this lesson you will see a number of Tukey post-hoc tests. Next, you will also learn how to obtain these results using Minitab.

For each pairwise comparison, \(H_0: \mu_i - \mu_j=0\) and \(H_a: \mu_i - \mu_j \ne 0\).

10.4 - Minitab: One-Way ANOVA

In one research study, 20 young pigs are assigned at random among 4 experimental groups. Each group is fed a different diet. (This design is a completely randomized design.) The data are the pigs' weights in kg after being raised on these diets for 10 months. We wish to determine if there are any differences in mean pig weights for the 4 diets.

  • \(H_0: \mu_1 = \mu_2 = \mu_3 = \mu_4\)
  • \(H_a:\) Not all \(\mu\) are equal

Contained in the Minitab file: ANOVA_ex.mpx

Note that in this file the data were entered so that each group is in its own column. In other words, the responses are in a separate column for each factor level. In later examples, you will see that Minitab will also conduct a one-way ANOVA if the responses are all in one column with the factor codes in another column. 

Minitab ®  – One-Way ANOVA

To perform an Analysis of Variance (ANOVA) test in Minitab:

  • Open the Minitab file: ANOVA_ex.mpx
  • From the menu bar, select  Stat > ANOVA > One-Way .
  • Click the drop-down menu and select 'Responses are in a separate column for each factor level' .
  • Enter the variables  Feed_1 ,  Feed_2 ,  Feed_3 , and  Feed_4  to insert them into the Responses box.
  • Choose the Comparisons button and check the box next to Tukey . Under Results also select Tests .

The result should be the following output:

Equal variances were assumed for the analysis

Factor Information

Analysis of variance, model summary.

Pooled StDev = 2.75386

Grouping Information Using the Tukey Method and 95% Confidence

Means that do not share a letter are significantly different.

Tukey Simultaneous Tests for Differences of Means

Individual confidence level = 98.87%

ANOVA Output - Example 3

10.5 - Example: SAT-Math Scores by Award Preference

In this example, we are comparing the SAT scores of students who said that they would prefer to win an Academy Award, a Nobel Prize, or an Olympic gold medal.

The example uses the StudentSurvey dataset provided by the Lock5 textbook.

Let's apply the five-step hypothesis testing process to this example.

The assumptions for a one-way between-groups ANOVA are:

Assumption: Samples are independent: Each student selected either Olympic, Academy, or Nobel. Each student is in only one group and those groups are in no way matched or paired. This assumption is met.

  Assumption: The response variable is approximately normally distributed for each group or all group sample sizes are at least 30: To check this we can construct a histogram with groups in Minitab. These plots show that the distributions are all approximately normal. 

Histograms of SAT grouped by award

  Assumption: The population variances are equal across responses for the group levels (if the largest sample standard deviation divided by the smallest sample standard deviation is  not  greater than  two , then assume that the population variances are equal). Again we can use Minitab to look at the standard deviations across the groups. The largest standard deviation is 151.3 and the smallest is 114.1 for a ratio of 1.33 which is less than 2. So this assumption is met.

Use Minitab to run a one-way ANOVA with the Minitab file: StudentSurvey.mpx

The following will describe the output within the context of the five-step hypothesis testing process.

You should get the following output:

The factor information tells us that our factor is the Award.

The analysis of variance table is also known as our ANOVA source table. The source of the Award is our between-groups variation so the DF K -1 or 3-1 = 2. Error is our within-groups variation so the degrees of freedom are n - K or 362-3 = 359. The 'Adj' stands for adjusted. For a one-way ANOVA, nothing is being adjusted. The F-value is our F-test statistic, which in this case is 11.67 with a p-value of 0.000. The F value could be written as F (2, 359) = 11.67.

Pooled StDev = 117.851

The Means table is just a table of descriptive statistics. The sample size, mean, and the standard deviation is presented for each group. The last column is an unadjusted 95% confidence interval. You should not refer to these confidence intervals since these do not take into account that there are three different groups and three different confidence intervals being computed at the same time. The confidence intervals that we're interested in come with our Tukey pairwise comparison.

 need to know two of these degrees of freedom: \(df_1 = df_{between}\) and \(df_2=df_{within}\).

The p-value is 0.000 from the Minitab output.

\(p \leq \alpha\) so reject the null hypothesis.

We can conclude that the group means are not all equal.

Remember that ANOVA is just an omnibus test. It only tells us there is a difference somewhere. To determine where the differences are you would have to look at the Tukey pairwise comparison output.

In the grouping table, Nobel and Olympic do not share a grouping letter. The means of these two groups are significantly different. Both the Nobel and Academy belong to Group A and both Academy and Olympic belong to Group B. These pairs are not significantly different.

The Tukey Simultaneous Tests table provides the adjusted 95% confidence intervals. These are the confidence intervals and p-values you should be looking at when you're making pairwise comparisons. These are adjusted to take into account that there are three different pairwise tests being performed simultaneously. To determine which groups are statistically significant we can look at the adjusted p-value. In this case, the only p-value less than 0.05 is the Olympic - Nobel pairwise comparison. The means of the Olympic and Nobel group are significantly different.

ANOVA Output - Example 3

In the Tukey Simultaneous 95% CI graph any interval not containing zero indicates a statistically significant difference. In this case, we see that the Olympic - Nobel group does not contain zero so this pairing has a statistically significant difference.

10.6 - Example: Exam Grade by Professor

Three professors were each teaching one section of a course. They all gave the same final exam and they want to know if there are any differences between their sections’ mean scores.

\(H_0:\mu_1=\mu_2=\mu_3\)

\(H_a: Not\;all\;\mu\;are\;equal\)

Pooled StDev = 17.2609

The standard deviations for all three classes are all similar.

  • Open the Minitab file: ANOVA_Exam_Profs.mpx
  • Using Minitab: Stat > ANOVA > One-Way

The result is the following ANOVA source table:

F (2, 242) = 1.07

From our ANOVA source table, p = .346

Because \(p > \alpha\), we fail to reject the null hypothesis.

There is not enough evidence to conclude that the mean scores from the three different professors’ sections are different.

Tukey Pairwise Comparisons

There is some debate as to whether pairwise comparisons are appropriate when the overall one-way ANOVA is not statistically significant. Some argue that if the overall ANOVA is not significant then pairwise comparisons are not necessary. Others argue that if the pairwise comparisons were planned before the ANOVA was conducted (i.e., "a priori") then they are appropriate.

The results of our Tukey pairwise comparisons were as follows:

Individual confidence level = 97.99%

Looking at the first table, all three instructors are in group A. Means that share a letter are not significantly different from one another (i.e., they are in the same group). Because all three instructors share the letter A, there are no significantly different pairs of instructors.

We could also look at the second table which gives us the t-test statistic and adjusted p-value for each possible pairwise comparison. This p-value is adjusted to take into account that multiple tests are being conducted. You can compare these p-values to the standard alpha level of .05.  All p-values are greater than .05, therefore no pairs are significantly different from one another. 

10.7 - Lesson 10 Summary

In this lesson you learned how to compare the means of three or more groups using a one-way between groups ANOVA. A one-way between groups ANOVA is used instead of multiple independent \(t\) tests in order to avoid increasing the likelihood of committing a Type I error.

An ANOVA provides information about the explanatory variable overall, but not about differences between the different levels of that variable. In order to compare the different pairs we need to conduct a post-hoc analysis such as Tukey's HSD test. 

Library homepage

  • school Campus Bookshelves
  • menu_book Bookshelves
  • perm_media Learning Objects
  • login Login
  • how_to_reg Request Instructor Account
  • hub Instructor Commons

Margin Size

  • Download Page (PDF)
  • Download Full Book (PDF)
  • Periodic Table
  • Physics Constants
  • Scientific Calculator
  • Reference & Cite
  • Tools expand_more
  • Readability

selected template will load here

This action is not available.

Statistics LibreTexts

1.2: The 7-Step Process of Statistical Hypothesis Testing

  • Last updated
  • Save as PDF
  • Page ID 33320

  • Penn State's Department of Statistics
  • The Pennsylvania State University

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

We will cover the seven steps one by one.

Step 1: State the Null Hypothesis

The null hypothesis can be thought of as the opposite of the "guess" the researchers made: in this example, the biologist thinks the plant height will be different for the fertilizers. So the null would be that there will be no difference among the groups of plants. Specifically, in more statistical language the null for an ANOVA is that the means are the same. We state the null hypothesis as: \[H_{0}: \ \mu_{1} = \mu_{2} = \ldots = \mu_{T}\] for \(T\) levels of an experimental treatment.

Why do we do this? Why not simply test the working hypothesis directly? The answer lies in the Popperian Principle of Falsification. Karl Popper (a philosopher) discovered that we can't conclusively confirm a hypothesis, but we can conclusively negate one. So we set up a null hypothesis which is effectively the opposite of the working hypothesis. The hope is that based on the strength of the data, we will be able to negate or reject the null hypothesis and accept an alternative hypothesis. In other words, we usually see the working hypothesis in \(H_{A}\).

Step 2: State the Alternative Hypothesis

\[H_{A}: \ \text{treatment level means not all equal}\]

The reason we state the alternative hypothesis this way is that if the null is rejected, there are many possibilities.

For example, \(\mu_{1} \neq \mu_{2} = \ldots = \mu_{T}\) is one possibility, as is \(\mu_{1} = \mu_{2} \neq \mu_{3} = \ldots = \mu_{T}\). Many people make the mistake of stating the alternative hypothesis as \(mu_{1} \neq mu_{2} \neq \ldots \neq \mu_{T}\), which says that every mean differs from every other mean. This is a possibility, but only one of many possibilities. To cover all alternative outcomes, we resort to a verbal statement of "not all equal" and then follow up with mean comparisons to find out where differences among means exist. In our example, this means that fertilizer 1 may result in plants that are really tall, but fertilizers 2, 3, and the plants with no fertilizers don't differ from one another. A simpler way of thinking about this is that at least one mean is different from all others.

Step 3: Set \(\alpha\)

If we look at what can happen in a hypothesis test, we can construct the following contingency table:

You should be familiar with type I and type II errors from your introductory course. It is important to note that we want to set \(\alpha\) before the experiment ( a priori ) because the Type I error is the more grievous error to make. The typical value of \(\alpha\) is 0.05, establishing a 95% confidence level. For this course, we will assume \(\alpha\) =0.05, unless stated otherwise.

Step 4: Collect Data

Remember the importance of recognizing whether data is collected through an experimental design or observational study.

Step 5: Calculate a test statistic

For categorical treatment level means, we use an \(F\) statistic, named after R.A. Fisher. We will explore the mechanics of computing the \(F\) statistic beginning in Chapter 2. The \(F\) value we get from the data is labeled \(F_{\text{calculated}}\).

Step 6: Construct Acceptance / Rejection regions

As with all other test statistics, a threshold (critical) value of \(F\) is established. This \(F\) value can be obtained from statistical tables or software and is referred to as \(F_{\text{critical}}\) or \(F_{\alpha}\). As a reminder, this critical value is the minimum value for the test statistic (in this case the F test) for us to be able to reject the null.

The \(F\) distribution, \(F_{\alpha}\), and the location of acceptance and rejection regions are shown in the graph below:

Graph of the F distribution, with the point F_alpha marked on the x-axis. The area under the curve to the left of this point is marked "Accept null", and the area under the curve to the right of this point is marked "Reject null."

Step 7: Based on steps 5 and 6, draw a conclusion about H0

If the \(F_{\text{\calculated}}\) from the data is larger than the \(F_{\alpha}\), then you are in the rejection region and you can reject the null hypothesis with \((1 - \alpha)\) level of confidence.

Note that modern statistical software condenses steps 6 and 7 by providing a \(p\)-value. The \(p\)-value here is the probability of getting an \(F_{\text{calculated}}\) even greater than what you observe assuming the null hypothesis is true. If by chance, the \(F_{\text{calculated}} = F_{\alpha}\), then the \(p\)-value would exactly equal \(\alpha\). With larger \(F_{\text{calculated}}\) values, we move further into the rejection region and the \(p\) - value becomes less than \(\alpha\). So the decision rule is as follows:

If the \(p\) - value obtained from the ANOVA is less than \(\alpha\), then reject \(H_{0}\) and accept \(H_{A}\).

If you are not familiar with this material, we suggest that you review course materials from your basic statistics course.

Hypothesis Testing - Analysis of Variance (ANOVA)

Lisa Sullivan, PhD

Professor of Biostatistics

Boston University School of Public Health

explain the hypothesis testing using one way of anova

Introduction

This module will continue the discussion of hypothesis testing, where a specific statement or hypothesis is generated about a population parameter, and sample statistics are used to assess the likelihood that the hypothesis is true. The hypothesis is based on available information and the investigator's belief about the population parameters. The specific test considered here is called analysis of variance (ANOVA) and is a test of hypothesis that is appropriate to compare means of a continuous variable in two or more independent comparison groups. For example, in some clinical trials there are more than two comparison groups. In a clinical trial to evaluate a new medication for asthma, investigators might compare an experimental medication to a placebo and to a standard treatment (i.e., a medication currently being used). In an observational study such as the Framingham Heart Study, it might be of interest to compare mean blood pressure or mean cholesterol levels in persons who are underweight, normal weight, overweight and obese.  

The technique to test for a difference in more than two independent means is an extension of the two independent samples procedure discussed previously which applies when there are exactly two independent comparison groups. The ANOVA technique applies when there are two or more than two independent groups. The ANOVA procedure is used to compare the means of the comparison groups and is conducted using the same five step approach used in the scenarios discussed in previous sections. Because there are more than two groups, however, the computation of the test statistic is more involved. The test statistic must take into account the sample sizes, sample means and sample standard deviations in each of the comparison groups.

If one is examining the means observed among, say three groups, it might be tempting to perform three separate group to group comparisons, but this approach is incorrect because each of these comparisons fails to take into account the total data, and it increases the likelihood of incorrectly concluding that there are statistically significate differences, since each comparison adds to the probability of a type I error. Analysis of variance avoids these problemss by asking a more global question, i.e., whether there are significant differences among the groups, without addressing differences between any two groups in particular (although there are additional tests that can do this if the analysis of variance indicates that there are differences among the groups).

The fundamental strategy of ANOVA is to systematically examine variability within groups being compared and also examine variability among the groups being compared.

Learning Objectives

After completing this module, the student will be able to:

  • Perform analysis of variance by hand
  • Appropriately interpret results of analysis of variance tests
  • Distinguish between one and two factor analysis of variance tests
  • Identify the appropriate hypothesis testing procedure based on type of outcome variable and number of samples

The ANOVA Approach

Consider an example with four independent groups and a continuous outcome measure. The independent groups might be defined by a particular characteristic of the participants such as BMI (e.g., underweight, normal weight, overweight, obese) or by the investigator (e.g., randomizing participants to one of four competing treatments, call them A, B, C and D). Suppose that the outcome is systolic blood pressure, and we wish to test whether there is a statistically significant difference in mean systolic blood pressures among the four groups. The sample data are organized as follows:

The hypotheses of interest in an ANOVA are as follows:

  • H 0 : μ 1 = μ 2 = μ 3 ... = μ k
  • H 1 : Means are not all equal.

where k = the number of independent comparison groups.

In this example, the hypotheses are:

  • H 0 : μ 1 = μ 2 = μ 3 = μ 4
  • H 1 : The means are not all equal.

The null hypothesis in ANOVA is always that there is no difference in means. The research or alternative hypothesis is always that the means are not all equal and is usually written in words rather than in mathematical symbols. The research hypothesis captures any difference in means and includes, for example, the situation where all four means are unequal, where one is different from the other three, where two are different, and so on. The alternative hypothesis, as shown above, capture all possible situations other than equality of all means specified in the null hypothesis.

Test Statistic for ANOVA

The test statistic for testing H 0 : μ 1 = μ 2 = ... =   μ k is:

and the critical value is found in a table of probability values for the F distribution with (degrees of freedom) df 1 = k-1, df 2 =N-k. The table can be found in "Other Resources" on the left side of the pages.

NOTE: The test statistic F assumes equal variability in the k populations (i.e., the population variances are equal, or s 1 2 = s 2 2 = ... = s k 2 ). This means that the outcome is equally variable in each of the comparison populations. This assumption is the same as that assumed for appropriate use of the test statistic to test equality of two independent means. It is possible to assess the likelihood that the assumption of equal variances is true and the test can be conducted in most statistical computing packages. If the variability in the k comparison groups is not similar, then alternative techniques must be used.

The F statistic is computed by taking the ratio of what is called the "between treatment" variability to the "residual or error" variability. This is where the name of the procedure originates. In analysis of variance we are testing for a difference in means (H 0 : means are all equal versus H 1 : means are not all equal) by evaluating variability in the data. The numerator captures between treatment variability (i.e., differences among the sample means) and the denominator contains an estimate of the variability in the outcome. The test statistic is a measure that allows us to assess whether the differences among the sample means (numerator) are more than would be expected by chance if the null hypothesis is true. Recall in the two independent sample test, the test statistic was computed by taking the ratio of the difference in sample means (numerator) to the variability in the outcome (estimated by Sp).  

The decision rule for the F test in ANOVA is set up in a similar way to decision rules we established for t tests. The decision rule again depends on the level of significance and the degrees of freedom. The F statistic has two degrees of freedom. These are denoted df 1 and df 2 , and called the numerator and denominator degrees of freedom, respectively. The degrees of freedom are defined as follows:

df 1 = k-1 and df 2 =N-k,

where k is the number of comparison groups and N is the total number of observations in the analysis.   If the null hypothesis is true, the between treatment variation (numerator) will not exceed the residual or error variation (denominator) and the F statistic will small. If the null hypothesis is false, then the F statistic will be large. The rejection region for the F test is always in the upper (right-hand) tail of the distribution as shown below.

Rejection Region for F   Test with a =0.05, df 1 =3 and df 2 =36 (k=4, N=40)

Graph of rejection region for the F statistic with alpha=0.05

For the scenario depicted here, the decision rule is: Reject H 0 if F > 2.87.

The ANOVA Procedure

We will next illustrate the ANOVA procedure using the five step approach. Because the computation of the test statistic is involved, the computations are often organized in an ANOVA table. The ANOVA table breaks down the components of variation in the data into variation between treatments and error or residual variation. Statistical computing packages also produce ANOVA tables as part of their standard output for ANOVA, and the ANOVA table is set up as follows: 

where  

  • X = individual observation,
  • k = the number of treatments or independent comparison groups, and
  • N = total number of observations or total sample size.

The ANOVA table above is organized as follows.

  • The first column is entitled "Source of Variation" and delineates the between treatment and error or residual variation. The total variation is the sum of the between treatment and error variation.
  • The second column is entitled "Sums of Squares (SS)" . The between treatment sums of squares is

and is computed by summing the squared differences between each treatment (or group) mean and the overall mean. The squared differences are weighted by the sample sizes per group (n j ). The error sums of squares is:

and is computed by summing the squared differences between each observation and its group mean (i.e., the squared differences between each observation in group 1 and the group 1 mean, the squared differences between each observation in group 2 and the group 2 mean, and so on). The double summation ( SS ) indicates summation of the squared differences within each treatment and then summation of these totals across treatments to produce a single value. (This will be illustrated in the following examples). The total sums of squares is:

and is computed by summing the squared differences between each observation and the overall sample mean. In an ANOVA, data are organized by comparison or treatment groups. If all of the data were pooled into a single sample, SST would reflect the numerator of the sample variance computed on the pooled or total sample. SST does not figure into the F statistic directly. However, SST = SSB + SSE, thus if two sums of squares are known, the third can be computed from the other two.

  • The third column contains degrees of freedom . The between treatment degrees of freedom is df 1 = k-1. The error degrees of freedom is df 2 = N - k. The total degrees of freedom is N-1 (and it is also true that (k-1) + (N-k) = N-1).
  • The fourth column contains "Mean Squares (MS)" which are computed by dividing sums of squares (SS) by degrees of freedom (df), row by row. Specifically, MSB=SSB/(k-1) and MSE=SSE/(N-k). Dividing SST/(N-1) produces the variance of the total sample. The F statistic is in the rightmost column of the ANOVA table and is computed by taking the ratio of MSB/MSE.  

A clinical trial is run to compare weight loss programs and participants are randomly assigned to one of the comparison programs and are counseled on the details of the assigned program. Participants follow the assigned program for 8 weeks. The outcome of interest is weight loss, defined as the difference in weight measured at the start of the study (baseline) and weight measured at the end of the study (8 weeks), measured in pounds.  

Three popular weight loss programs are considered. The first is a low calorie diet. The second is a low fat diet and the third is a low carbohydrate diet. For comparison purposes, a fourth group is considered as a control group. Participants in the fourth group are told that they are participating in a study of healthy behaviors with weight loss only one component of interest. The control group is included here to assess the placebo effect (i.e., weight loss due to simply participating in the study). A total of twenty patients agree to participate in the study and are randomly assigned to one of the four diet groups. Weights are measured at baseline and patients are counseled on the proper implementation of the assigned diet (with the exception of the control group). After 8 weeks, each patient's weight is again measured and the difference in weights is computed by subtracting the 8 week weight from the baseline weight. Positive differences indicate weight losses and negative differences indicate weight gains. For interpretation purposes, we refer to the differences in weights as weight losses and the observed weight losses are shown below.

Is there a statistically significant difference in the mean weight loss among the four diets?  We will run the ANOVA using the five-step approach.

  • Step 1. Set up hypotheses and determine level of significance

H 0 : μ 1 = μ 2 = μ 3 = μ 4 H 1 : Means are not all equal              α=0.05

  • Step 2. Select the appropriate test statistic.  

The test statistic is the F statistic for ANOVA, F=MSB/MSE.

  • Step 3. Set up decision rule.  

The appropriate critical value can be found in a table of probabilities for the F distribution(see "Other Resources"). In order to determine the critical value of F we need degrees of freedom, df 1 =k-1 and df 2 =N-k. In this example, df 1 =k-1=4-1=3 and df 2 =N-k=20-4=16. The critical value is 3.24 and the decision rule is as follows: Reject H 0 if F > 3.24.

  • Step 4. Compute the test statistic.  

To organize our computations we complete the ANOVA table. In order to compute the sums of squares we must first compute the sample means for each group and the overall mean based on the total sample.  

We can now compute

So, in this case:

Next we compute,

SSE requires computing the squared differences between each observation and its group mean. We will compute SSE in parts. For the participants in the low calorie diet:  

For the participants in the low fat diet:  

For the participants in the low carbohydrate diet:  

For the participants in the control group:

We can now construct the ANOVA table .

  • Step 5. Conclusion.  

We reject H 0 because 8.43 > 3.24. We have statistically significant evidence at α=0.05 to show that there is a difference in mean weight loss among the four diets.    

ANOVA is a test that provides a global assessment of a statistical difference in more than two independent means. In this example, we find that there is a statistically significant difference in mean weight loss among the four diets considered. In addition to reporting the results of the statistical test of hypothesis (i.e., that there is a statistically significant difference in mean weight losses at α=0.05), investigators should also report the observed sample means to facilitate interpretation of the results. In this example, participants in the low calorie diet lost an average of 6.6 pounds over 8 weeks, as compared to 3.0 and 3.4 pounds in the low fat and low carbohydrate groups, respectively. Participants in the control group lost an average of 1.2 pounds which could be called the placebo effect because these participants were not participating in an active arm of the trial specifically targeted for weight loss. Are the observed weight losses clinically meaningful?

Another ANOVA Example

Calcium is an essential mineral that regulates the heart, is important for blood clotting and for building healthy bones. The National Osteoporosis Foundation recommends a daily calcium intake of 1000-1200 mg/day for adult men and women. While calcium is contained in some foods, most adults do not get enough calcium in their diets and take supplements. Unfortunately some of the supplements have side effects such as gastric distress, making them difficult for some patients to take on a regular basis.  

 A study is designed to test whether there is a difference in mean daily calcium intake in adults with normal bone density, adults with osteopenia (a low bone density which may lead to osteoporosis) and adults with osteoporosis. Adults 60 years of age with normal bone density, osteopenia and osteoporosis are selected at random from hospital records and invited to participate in the study. Each participant's daily calcium intake is measured based on reported food intake and supplements. The data are shown below.   

Is there a statistically significant difference in mean calcium intake in patients with normal bone density as compared to patients with osteopenia and osteoporosis? We will run the ANOVA using the five-step approach.

H 0 : μ 1 = μ 2 = μ 3 H 1 : Means are not all equal                            α=0.05

In order to determine the critical value of F we need degrees of freedom, df 1 =k-1 and df 2 =N-k.   In this example, df 1 =k-1=3-1=2 and df 2 =N-k=18-3=15. The critical value is 3.68 and the decision rule is as follows: Reject H 0 if F > 3.68.

To organize our computations we will complete the ANOVA table. In order to compute the sums of squares we must first compute the sample means for each group and the overall mean.  

 If we pool all N=18 observations, the overall mean is 817.8.

We can now compute:

Substituting:

SSE requires computing the squared differences between each observation and its group mean. We will compute SSE in parts. For the participants with normal bone density:

For participants with osteopenia:

For participants with osteoporosis:

We do not reject H 0 because 1.395 < 3.68. We do not have statistically significant evidence at a =0.05 to show that there is a difference in mean calcium intake in patients with normal bone density as compared to osteopenia and osterporosis. Are the differences in mean calcium intake clinically meaningful? If so, what might account for the lack of statistical significance?

One-Way ANOVA in R

The video below by Mike Marin demonstrates how to perform analysis of variance in R. It also covers some other statistical issues, but the initial part of the video will be useful to you.

Two-Factor ANOVA

The ANOVA tests described above are called one-factor ANOVAs. There is one treatment or grouping factor with k > 2 levels and we wish to compare the means across the different categories of this factor. The factor might represent different diets, different classifications of risk for disease (e.g., osteoporosis), different medical treatments, different age groups, or different racial/ethnic groups. There are situations where it may be of interest to compare means of a continuous outcome across two or more factors. For example, suppose a clinical trial is designed to compare five different treatments for joint pain in patients with osteoarthritis. Investigators might also hypothesize that there are differences in the outcome by sex. This is an example of a two-factor ANOVA where the factors are treatment (with 5 levels) and sex (with 2 levels). In the two-factor ANOVA, investigators can assess whether there are differences in means due to the treatment, by sex or whether there is a difference in outcomes by the combination or interaction of treatment and sex. Higher order ANOVAs are conducted in the same way as one-factor ANOVAs presented here and the computations are again organized in ANOVA tables with more rows to distinguish the different sources of variation (e.g., between treatments, between men and women). The following example illustrates the approach.

Consider the clinical trial outlined above in which three competing treatments for joint pain are compared in terms of their mean time to pain relief in patients with osteoarthritis. Because investigators hypothesize that there may be a difference in time to pain relief in men versus women, they randomly assign 15 participating men to one of the three competing treatments and randomly assign 15 participating women to one of the three competing treatments (i.e., stratified randomization). Participating men and women do not know to which treatment they are assigned. They are instructed to take the assigned medication when they experience joint pain and to record the time, in minutes, until the pain subsides. The data (times to pain relief) are shown below and are organized by the assigned treatment and sex of the participant.

Table of Time to Pain Relief by Treatment and Sex

The analysis in two-factor ANOVA is similar to that illustrated above for one-factor ANOVA. The computations are again organized in an ANOVA table, but the total variation is partitioned into that due to the main effect of treatment, the main effect of sex and the interaction effect. The results of the analysis are shown below (and were generated with a statistical computing package - here we focus on interpretation). 

 ANOVA Table for Two-Factor ANOVA

There are 4 statistical tests in the ANOVA table above. The first test is an overall test to assess whether there is a difference among the 6 cell means (cells are defined by treatment and sex). The F statistic is 20.7 and is highly statistically significant with p=0.0001. When the overall test is significant, focus then turns to the factors that may be driving the significance (in this example, treatment, sex or the interaction between the two). The next three statistical tests assess the significance of the main effect of treatment, the main effect of sex and the interaction effect. In this example, there is a highly significant main effect of treatment (p=0.0001) and a highly significant main effect of sex (p=0.0001). The interaction between the two does not reach statistical significance (p=0.91). The table below contains the mean times to pain relief in each of the treatments for men and women (Note that each sample mean is computed on the 5 observations measured under that experimental condition).  

Mean Time to Pain Relief by Treatment and Gender

Treatment A appears to be the most efficacious treatment for both men and women. The mean times to relief are lower in Treatment A for both men and women and highest in Treatment C for both men and women. Across all treatments, women report longer times to pain relief (See below).  

Graph of two-factor ANOVA

Notice that there is the same pattern of time to pain relief across treatments in both men and women (treatment effect). There is also a sex effect - specifically, time to pain relief is longer in women in every treatment.  

Suppose that the same clinical trial is replicated in a second clinical site and the following data are observed.

Table - Time to Pain Relief by Treatment and Sex - Clinical Site 2

The ANOVA table for the data measured in clinical site 2 is shown below.

Table - Summary of Two-Factor ANOVA - Clinical Site 2

Notice that the overall test is significant (F=19.4, p=0.0001), there is a significant treatment effect, sex effect and a highly significant interaction effect. The table below contains the mean times to relief in each of the treatments for men and women.  

Table - Mean Time to Pain Relief by Treatment and Gender - Clinical Site 2

Notice that now the differences in mean time to pain relief among the treatments depend on sex. Among men, the mean time to pain relief is highest in Treatment A and lowest in Treatment C. Among women, the reverse is true. This is an interaction effect (see below).  

Graphic display of the results in the preceding table

Notice above that the treatment effect varies depending on sex. Thus, we cannot summarize an overall treatment effect (in men, treatment C is best, in women, treatment A is best).    

When interaction effects are present, some investigators do not examine main effects (i.e., do not test for treatment effect because the effect of treatment depends on sex). This issue is complex and is discussed in more detail in a later module. 

Logo for University of Southern Queensland

Want to create or adapt books like this? Learn more about how Pressbooks supports open publishing practices.

Section 6.2: One-Way ANOVA Assumptions, Interpretation, and Write Up

Learning Objectives

At the end of this section you should be able to answer the following questions:

  • What are assumptions that need to be met before performing a Between Groups ANOVA?
  • How would you interpret a Main Effect in a One-Way ANOVA?

One-Way ANOVA Assumptions

There are a number of assumptions that need to be met before performing a Between Groups ANOVA:

  • The dependent variable (the variable of interest) needs to be a continuous scale (i.e., the data needs to be at either an interval or ratio measurement).
  • The independent variable needs to have two independent groups with two levels. When testing three or more independent, categorical groups it is best to use a one-way ANOVA, The test could be used to test the difference between just two groups, however, an independent samples t-test would be more appropriate.
  • The data should have independence of observations (i.e., there shouldn’t be the same participants who are in both groups.)
  • The dependent variable should be normally or near-to-normally distributed for each group. It is worth noting that while the t-test is robust for minor violations in normality, if your data is very non-normal, it would be worth using a non-parametric test or bootstrapping (see later chapters).
  • There should be no spurious outliers.
  • The data must have homogeneity of variances. This assumption can be tested using Levene’s test for homogeneity of variances in the statistics package. which is shown in the output included in the next chapter.

Sample Size

A consideration for ANOVA is homogeneity. Homogeneity, in this context, just means that all of the groups’ distribution and errors differ in approximately the same way, regardless of the mean for each group. The more incompatible or unequal the group sizes are in a simple one-way between-subjects ANOVA, the more important the assumption of homogeneity is. Unequal group sizes in factorial designs can create ambiguity in results. You can test for homogeneity in PSPP and SPSS. In this class, a significant result indicates that homogeneity has been violated.

Equal cell Sizes

It is preferable to have similar or the same number of observations in each group. This provides a stronger model that tends not to violate any of the assumptions. Having unequal groups can lead to violations in normality or homogeneity of variance.

One-Way ANOVA Interpretation

Below you click to see the output for the ANOVA test of the Research Question, we have included the research example and hypothesis we will be working through is: Is there a difference in reported levels of mental distress for full-time, part-time, and casual employees?

PowerPoint: One Way ANOVA

Please have a look at the following slides:

  • Chapter Six – One Way ANOVA

Main Effects

As can be seen in the circled section in red on Slide 3, the main effect was significant. By looking at the purple circle, we can see the means for each group. In the light blue circle is the test statistic, which in this case is the F value. Finally, in the dark blue circle, we can see both values for the degrees of freedom.

Posthoc Tests

In order to run posthoc tests, we need to enter some syntax. This will be covered in the slides for this section, so please do go and have a look at the syntax that has been used. The information has also been included on Slide 4.

Posthoc Test Results

These are the results. There are a number of different tests that can be used in posthoc differences tests, to control for type 1 or type 2 errors, however, for this example none have been used.

Table of data on mental distress and employment

As can be seen in the red and green circles on Slide 6, both part-time and casual workers reported higher mental distress than full-time workers. This can be cross-referenced with the means on the results slide. As be seen in blue, there was not a significant difference between casual and part-time workers.

One-Way ANOVA Write Up

The following text represents how you may write up a One Way ANOVA:

A one-way ANOVA was conducted to determine if levels of mental distress were different across employment status. Participants were classified into three groups: Full-time (n = 161), Part-time (n = 83), Casual (n = 123). There was a statistically significant difference between groups as determined by one-way ANOVA ( F (2,364) = 13.17, p < .001). Post-hoc tests revealed that mental distress was significantly higher in participants who were part-time and casually employed, when compare to full-time ( Mdiff   = 4.11, p = .012, and Mdiff   = 7.34, p < .001, respectively). Additionally, no difference was found between participants who were employed part-time and casually ( Mdiff   =3.23, p = .06).

Statistics for Research Students Copyright © 2022 by University of Southern Queensland is licensed under a Creative Commons Attribution 4.0 International License , except where otherwise noted.

Share This Book

One-way ANOVA in SPSS Statistics

Introduction.

The one-way analysis of variance (ANOVA) is used to determine whether there are any statistically significant differences between the means of two or more independent (unrelated) groups (although you tend to only see it used when there are a minimum of three, rather than two groups). For example, you could use a one-way ANOVA to understand whether exam performance differed based on test anxiety levels amongst students, dividing students into three independent groups (e.g., low, medium and high-stressed students). Also, it is important to realize that the one-way ANOVA is an omnibus test statistic and cannot tell you which specific groups were statistically significantly different from each other; it only tells you that at least two groups were different. Since you may have three, four, five or more groups in your study design, determining which of these groups differ from each other is important. You can do this using a post hoc test (N.B., we discuss post hoc tests later in this guide).

Note: If your study design not only involves one dependent variable and one independent variable, but also a third variable (known as a "covariate") that you want to "statistically control", you may need to perform an ANCOVA (analysis of covariance), which can be thought of as an extension of the one-way ANOVA. To learn more, see our SPSS Statistics guide on ANCOVA . Alternatively, if your dependent variable is the time until an event happens, you might need to run a Kaplan-Meier analysis.

This "quick start" guide shows you how to carry out a one-way ANOVA using SPSS Statistics, as well as interpret and report the results from this test. Since the one-way ANOVA is often followed up with a post hoc test, we also show you how to carry out a post hoc test using SPSS Statistics. However, before we introduce you to this procedure, you need to understand the different assumptions that your data must meet in order for a one-way ANOVA to give you a valid result. We discuss these assumptions next.

SPSS Statistics

Assumptions.

When you choose to analyse your data using a one-way ANOVA, part of the process involves checking to make sure that the data you want to analyse can actually be analysed using a one-way ANOVA. You need to do this because it is only appropriate to use a one-way ANOVA if your data "passes" six assumptions that are required for a one-way ANOVA to give you a valid result. In practice, checking for these six assumptions just adds a little bit more time to your analysis, requiring you to click a few more buttons in SPSS Statistics when performing your analysis, as well as think a little bit more about your data, but it is not a difficult task.

Before we introduce you to these six assumptions, do not be surprised if, when analysing your own data using SPSS Statistics, one or more of these assumptions is violated (i.e., is not met). This is not uncommon when working with real-world data rather than textbook examples, which often only show you how to carry out a one-way ANOVA when everything goes well! However, don’t worry. Even when your data fails certain assumptions, there is often a solution to overcome this. First, let’s take a look at these six assumptions:

  • Assumption #1: Your dependent variable should be measured at the interval or ratio level (i.e., they are continuous ). Examples of variables that meet this criterion include revision time (measured in hours), intelligence (measured using IQ score), exam performance (measured from 0 to 100), weight (measured in kg), and so forth. You can learn more about interval and ratio variables in our article: Types of Variable .
  • Assumption #2: Your independent variable should consist of two or more categorical , independent groups . Typically, a one-way ANOVA is used when you have three or more categorical, independent groups, but it can be used for just two groups (but an independent-samples t-test is more commonly used for two groups). Example independent variables that meet this criterion include ethnicity (e.g., 3 groups: Caucasian, African American and Hispanic), physical activity level (e.g., 4 groups: sedentary, low, moderate and high), profession (e.g., 5 groups: surgeon, doctor, nurse, dentist, therapist), and so forth.
  • Assumption #3: You should have independence of observations , which means that there is no relationship between the observations in each group or between the groups themselves. For example, there must be different participants in each group with no participant being in more than one group. This is more of a study design issue than something you can test for, but it is an important assumption of the one-way ANOVA. If your study fails this assumption, you will need to use another statistical test instead of the one-way ANOVA (e.g., a repeated measures design). If you are unsure whether your study meets this assumption, you can use our Statistical Test Selector , which is part of our enhanced guides.
  • Assumption #4: There should be no significant outliers . Outliers are simply single data points within your data that do not follow the usual pattern (e.g., in a study of 100 students' IQ scores, where the mean score was 108 with only a small variation between students, one student had a score of 156, which is very unusual, and may even put her in the top 1% of IQ scores globally). The problem with outliers is that they can have a negative effect on the one-way ANOVA, reducing the validity of your results. Fortunately, when using SPSS Statistics to run a one-way ANOVA on your data, you can easily detect possible outliers. In our enhanced one-way ANOVA guide, we: (a) show you how to detect outliers using SPSS Statistics; and (b) discuss some of the options you have in order to deal with outliers. You can learn more about our enhanced one-way ANOVA guide on our Features: One-way ANOVA page.
  • Assumption #5: Your dependent variable should be approximately normally distributed for each category of the independent variable . We talk about the one-way ANOVA only requiring approximately normal data because it is quite "robust" to violations of normality, meaning that assumption can be a little violated and still provide valid results. You can test for normality using the Shapiro-Wilk test of normality, which is easily tested for using SPSS Statistics. In addition to showing you how to do this in our enhanced one-way ANOVA guide, we also explain what you can do if your data fails this assumption (i.e., if it fails it more than a little bit). Again, you can learn more on our Features: One-way ANOVA page.
  • Assumption #6: There needs to be homogeneity of variances . You can test this assumption in SPSS Statistics using Levene's test for homogeneity of variances. If your data fails this assumption, you will need to not only carry out a Welch ANOVA instead of a one-way ANOVA, which you can do using SPSS Statistics, but also use a different post hoc test. In our enhanced one-way ANOVA guide, we (a) show you how to perform Levene’s test for homogeneity of variances in SPSS Statistics, (b) explain some of the things you will need to consider when interpreting your data, and (c) present possible ways to continue with your analysis if your data fails to meet this assumption, including running a Welch ANOVA in SPSS Statistics instead of a one-way ANOVA, and a Games-Howell test instead of a Tukey post hoc test (learn more on our Features: One-way ANOVA page).

You can check assumptions #4, #5 and #6 using SPSS Statistics. Before doing this, you should make sure that your data meets assumptions #1, #2 and #3, although you don't need SPSS Statistics to do this. Remember that if you do not run the statistical tests on these assumptions correctly, the results you get when running a one-way ANOVA might not be valid. This is why we dedicate a number of sections of our enhanced one-way ANOVA guide to help you get this right. You can find out about our enhanced one-way ANOVA guide on our Features: One-way ANOVA page, or more generally, our enhanced content as a whole on our Features: Overview page.

In the section, Test Procedure in SPSS Statistics , we illustrate the SPSS Statistics procedure to perform a one-way ANOVA assuming that no assumptions have been violated. First, we set out the example we use to explain the one-way ANOVA procedure in SPSS Statistics.

A manager wants to raise the productivity at his company by increasing the speed at which his employees can use a particular spreadsheet program. As he does not have the skills in-house, he employs an external agency which provides training in this spreadsheet program. They offer 3 courses: a beginner, intermediate and advanced course. He is unsure which course is needed for the type of work they do at his company, so he sends 10 employees on the beginner course, 10 on the intermediate and 10 on the advanced course. When they all return from the training, he gives them a problem to solve using the spreadsheet program, and times how long it takes them to complete the problem. He then compares the three courses (beginner, intermediate, advanced) to see if there are any differences in the average time it took to complete the problem.

Setup in SPSS Statistics

In SPSS Statistics, we separated the groups for analysis by creating a grouping variable called Course (i.e., the independent variable), and gave the beginners course a value of "1", the intermediate course a value of "2" and the advanced course a value of "3". Time to complete the set problem was entered under the variable name Time (i.e., the dependent variable). In our enhanced one-way ANOVA guide, we show you how to correctly enter data in SPSS Statistics to run a one-way ANOVA (see on our Features: One-way ANOVA page). You can learn about our enhanced data setup content in general on our Features: Data Setup . Alternately, see our generic, "quick start" guide: Entering Data in SPSS Statistics .

Access all 96 SPSS Statistics guides in Laerd Statistics

Plans and pricing banner. Click on to see our student-friendly pricing to become a member of Laerd Statistics

Test Procedure in SPSS Statistics

The eight steps below show you how to analyse your data using a one-way ANOVA in SPSS Statistics when the six assumptions in the previous section, Assumptions , have not been violated. At the end of these eight steps, we show you how to interpret the results from this test. If you are looking for help to make sure your data meets assumptions #4, #5 and #6, which are required when using a one-way ANOVA, and can be tested using SPSS Statistics, you can learn more on our Features: One-way ANOVA page.

Menu for the one-way ANOVA in SPSS Statistics

Published with written permission from SPSS Statistics, IBM Corporation.

'One-Way ANOVA' dialogue box in SPSS Statistics. Variables 'Course' & 'Time' on the left

NOTE: When testing for some of the assumptions of the one-way ANOVA, you will need to tick more of these checkboxes. We take you through this, including how to interpret the output, in our enhanced one-way ANOVA guide.

OK

Go to the next page for the SPSS Statistics output and an explanation of the output.

U.S. flag

An official website of the United States government

The .gov means it’s official. Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

The site is secure. The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

  • Publications
  • Account settings

Preview improvements coming to the PMC website in October 2024. Learn More or Try it out now .

  • Advanced Search
  • Journal List
  • Korean J Anesthesiol
  • v.70(1); 2017 Feb

Understanding one-way ANOVA using conceptual figures

Tae kyun kim.

Department of Anesthesia and Pain Medicine, Pusan National University Yangsan Hospital and School of Medicine, Yangsan, Korea.

Analysis of variance (ANOVA) is one of the most frequently used statistical methods in medical research. The need for ANOVA arises from the error of alpha level inflation, which increases Type 1 error probability (false positive) and is caused by multiple comparisons. ANOVA uses the statistic F, which is the ratio of between and within group variances. The main interest of analysis is focused on the differences of group means; however, ANOVA focuses on the difference of variances. The illustrated figures would serve as a suitable guide to understand how ANOVA determines the mean difference problems by using between and within group variance differences.

Introduction

The differences in the means of two groups that are mutually independent and satisfy both the normality and equal variance assumptions can be obtained by comparing them using a Student's t-test. However, we may have to determine whether differences exist in the means of 3 or more groups. Most readers are already aware of the fact that the most common analytical method for this is the one-way analysis of variance (ANOVA). The present article aims to examine the necessity of using a one-way ANOVA instead of simply repeating the comparisons using Student's t-test. ANOVA literally means analysis of variance, and the present article aims to use a conceptual illustration to explain how the difference in means can be explained by comparing the variances rather by the means themselves.

Significance Level Inflation

In the comparison of the means of three groups that are mutually independent and satisfy the normality and equal variance assumptions, when each group is paired with another to attempt three paired comparisons 1) , the increase in Type I error becomes a common occurrence. In other words, even though the null hypothesis is true, the probability of rejecting it increases, whereby the probability of concluding that the alternative hypothesis (research hypothesis) has significance increases, despite the fact that it has no significance.

Let us assume that the distribution of differences in the means of two groups is as shown in Fig. 1 . The maximum allowable error range that can claim “differences in means exist” can be defined as the significance level (α). This is the maximum probability of Type I error that can reject the null hypothesis of “differences in means do not exist” in the comparison between two mutually independent groups obtained from one experiment. When the null hypothesis is true, the probability of accepting it becomes 1-α.

An external file that holds a picture, illustration, etc.
Object name is kjae-70-22-g001.jpg

Now, let us compare the means of three groups. Often, the null hypothesis in the comparison of three groups would be “the population means of three groups are all the same,” however, the alternative hypothesis is not “the population means of three groups are all different,” but rather, it is “at least one of the population means of three groups is different.” In other words, the null hypothesis (H 0 ) and the alternative hypothesis (H 1 ) are as follows:

Therefore, among the three groups, if the means of any two groups are different from each other, the null hypothesis can be rejected.

In that case, let us examine whether the probability of rejecting the entire null hypothesis remains consistent, when two continuous comparisons are made on hypotheses that are not mutually independent. When the null hypothesis is true, if the null hypothesis is rejected from a single comparison, then the entire null hypothesis can be rejected. Accordingly, the probability of rejecting the entire null hypothesis from two comparisons can be derived by firstly calculating the probability of accepting the null hypothesis from two comparisons, and then subtracting that value from 1. Therefore, the probability of rejecting the entire null hypothesis from two comparisons is as follows:

If the comparisons are made n times, the probability of rejecting the entire null hypothesis can be expressed as follows:

It can be seen that as the number of comparisons increases, the probability of rejecting the entire null hypothesis also increases. Assuming the significance level for a single comparison to be 0.05, the increases in the probability of rejecting the entire null hypothesis according to the number of comparisons are shown in Table 1 .

ANOVA Table

Although various methods have been used to avoid the hypothesis testing error due to significance level inflation, such as adjusting the significance level by the number of comparisons, the ideal method for resolving this problem as a single statistic is the use of ANOVA. ANOVA is an acronym for analysis of variance, and as the name itself implies, it is variance analysis. Let us examine the reason why the differences in means can be explained by analyzing the variances, despite the fact that the core of the problem that we want to figure out lies with the comparisons of means.

For example, let us examine whether there are differences in the height of students according to their grades ( Table 2 ). First, let us examine the ANOVA table ( Table 3 ) that is commonly obtained as a product of ANOVA. In Table 3 , the significance is ultimately determined using a significance probability value (P value), and in order to obtain this value, the statistic and its position in the distribution to which it belongs, must be known. In other words, there has to be a distribution that serves as the reference and that distribution is called F distribution. This F comes from the name of the statistician Ronald Fisher . The ANOVA test is also referred to as the F test, and F distribution is a distribution formed by the variance ratios. Accordingly, F statistic is expressed as a variance ratio, as shown below.

Raw data of students' heights in three different classes. Each class consists of thirty students.

Ȳ i is the mean of the group i; n i is the number of observations of the group i; Ȳ is the overall mean; K is the number of groups; Y ij is the j th observational value of group i; and N is the number of all observational values. The F statistic is the ratio of intergroup mean sum of squares to intragroup mean sum of squares.

Here, Ȳ i is the mean of the group i; n i is the number of observations of the group i; Ȳ is the overall mean; K is the number of groups; Y ij is the j th observational value of group i; and N is the number of all observational values.

It is not easy to look at this complex equation and understand ANOVA at a single glance. The meaning of this equation will be explained as an illustration for easier understanding. Statistics can be regarded as a study field that attempts to express data which are difficult to understand with an easy and simple ways so that they can be represented in a brief and simple forms. What that means is, instead of independently observing the groups of scattered points, as shown in Fig. 2A , the explanation could be given with the points lumped together as a single representative value. Values that are commonly referred to as the mean, median, and mode can be used as the representative value. Here, let us assume that the black rectangle in the middle represents the overall mean. However, a closer look shows that the points inside the circle have different shapes and the points with the same shape appear to be gathered together. Therefore, explaining all the points with just the overall mean would be inappropriate, and the points would be divided into groups in such a way that the same shapes belong to the same group. Although it is more cumbersome than explaining the entire population with just the overall mean, it is more reasonable to first form groups of points with the same shape and establish the mean for each group, and then explain the population with the three means. Therefore, as shown in Fig. 2B , the groups were divided into three and the mean was established in the center of each group in an effort to explain the entire population with these three points. Now the question arises as to how can one evaluate whether there are differences in explaining with the representative value of the three groups (e.g.; mean) versus explaining with lumping them together as a single overall mean.

An external file that holds a picture, illustration, etc.
Object name is kjae-70-22-g002.jpg

First, let us measure the distance between the overall mean and the mean of each group, and the distance from the mean of each group to each data within that group. The distance between the overall mean and the mean of each group was expressed as a solid arrow line ( Fig. 2C ). This distance is expressed as (Ȳ i − Ȳ) 2 , which appears in the denominator of the equation for calculating the F statistic. Here, the number of data in each group are multiplied, n i (Ȳ i − Ȳ) 2 . This is because explaining with the representative value of a single group is the same as considering that all the data in that group are accumulated at the representative value. Therefore, the amount of variance which is induced by explaining with the points divided into groups can be seen, as compared to explaining with the overall mean, and this explains inter-group variance.

Let us return to the equation for deriving the F statistic. The meaning of ( Y ij − Ȳ i ) 2 in the numerator is represented as an illustration in Fig. 2C , and the distance from the mean of each group to each data is shown by the dotted line arrows. In the figure, this distance represents the distance from the mean within the group to the data within that group, which explains the intragroup variance.

By looking at the equation for F statistic, it can be seen that this inter- or intragroup variance was divided into inter- and intragroup freedom. Let us assume that when all the fingers are stretched out, the mean value of the finger length is represented by the index finger. If the differences in finger lengths are compared to find the variance, then it can be seen that although there are 5 fingers, the number of gaps between the fingers is 4. To derive the mean variance, the intergroup variance was divided by freedom of 2, while the intragroup variance was divided by the freedom of 87, which was the overall number obtained by subtracting 1 from each group.

What can be understood by deriving the variance can be described in this manner. In Figs. 3A and 3B , the explanations are given with two different examples. Although the data were divided into three groups, there may be cases in which the intragroup variance is too big ( Fig. 3A ), so it appears that nothing is gained by dividing into three groups, since the boundaries become ambiguous and the group mean is not far from the overall mean. It seems that it would have been more efficient to explain the entire population with the overall mean. Alternatively, when the intergroup variance is relatively larger than the intragroup variance, in other word, when the distance from the overall mean to the mean of each group is far ( Fig. 3B ), the boundaries between the groups become more clear, and explaining by dividing into three group appears more logical than lumping together as the overall mean.

An external file that holds a picture, illustration, etc.
Object name is kjae-70-22-g003.jpg

Ultimately, the positions of statistic derived in this manner from the inter- and intragroup variance ratios can be identified from the F distribution ( Fig. 4 ). When the statistic 3.629 in the ANOVA table is positioned more to the right than 3.101, which is a value corresponding to the significance level of 0.05 in the F distribution with freedoms of 2 and 87, meaning bigger than 3.101, the null hypothesis can be rejected.

An external file that holds a picture, illustration, etc.
Object name is kjae-70-22-g004.jpg

Post-hoc Test

Anyone who has performed ANOVA has heard of the term post-hoc test. It refers to “the analysis after the fact” and it is derived from the Latin word for “after that.” The reason for performing a post-hoc test is that the conclusions that can be derived from the ANOVA test have limitations. In other words, when the null hypothesis that says the population means of three mutually independent groups are the same is rejected, the information that can be obtained is not that the three groups are different from each other. It only provides information that the means of the three groups may differ and at least one group may show a difference. This means that it does not provide information on which group differs from which other group ( Fig. 5 ). As a result, the comparisons are made with different pairings of groups, undergoing an additional process of verifying which group differs from which other group. This process is referred to as the post-hoc test.

An external file that holds a picture, illustration, etc.
Object name is kjae-70-22-g005.jpg

The significance level is adjusted by various methods [ 1 ], such as dividing the significance level by the number of comparisons made. Depending on the adjustment method, various post-hoc tests can be conducted. Whichever method is used, there would be no major problems, as long as that method is clearly described. One of the most well-known methods is the Bonferroni's correction. To explain this briefly, the significance level is divided by the number of comparisons and applied to the comparisons of each group. For example, when comparing the population means of three mutually independent groups A, B, and C, if the significance level is 0.05, then the significance level used for comparisons of groups A and B, groups A and C, and groups B and C would be 0.05/3 = 0.017. Other methods include Turkey, Schéffe, and Holm methods, all of which are applicable only when the equal variance assumption is satisfied; however, when this assumption is not satisfied, then Games Howell method can be applied. These post-hoc tests could produce different results, and therefore, it would be good to prepare at least 3 post-hoc tests prior to carrying out the actual study. Among the different types of post-hoc tests it is recommended that results which appear the most frequent should be used to interpret the differences in the population means.

Conclusions

It is believed that a wide variety of approaches and explanatory methods are available for explaining ANOVA. However, illustrations in this manuscript were presented as a tool for providing an understanding to those who are dealing with statistics for the first time. As the author who reproduced ANOVA is a non-statistician, there may be some errors in the illustrations. However, it should be sufficient for understanding ANOVA at a single glance and grasping its basic concept.

ANOVA also falls under the category of parametric analysis methods which perform the analysis after defining the distribution of the recruitment population in advance. Therefore, normality, independence, and equal variance of the samples must be satisfied for ANOVA. The processes of verification on whether the samples were extracted independently from each other, Levene's test for determining whether homogeneity of variance was satisfied, and Shapiro-Wilk or Kolmogorov test for determining whether normality was satisfied must be conducted prior to deriving the results [ 2 , 3 , 4 ].

1) A, B, C three paired comparisons: A vs B, A vs C and B vs C.

  • School Guide
  • Mathematics
  • Number System and Arithmetic
  • Trigonometry
  • Probability
  • Mensuration
  • Maths Formulas
  • Class 8 Maths Notes
  • Class 9 Maths Notes
  • Class 10 Maths Notes
  • Class 11 Maths Notes
  • Class 12 Maths Notes

One-Way ANOVA

  • How to Perform a Two-Way ANOVA in Python
  • Anscombe’s quartet
  • Alpha and Beta test
  • Kruskal Wallis Test
  • Anova Formula
  • How to Perform a One-Way ANOVA in Python
  • Applications of ANOVA in Real Life
  • Rat in a Maze
  • MANOVA Test in R Programming
  • Maze With N doors and 1 Key
  • How to Perform an ANCOVA Test in Excel?
  • Two Rats in a Maze
  • Mu Sigma Interview On Campus
  • What is A/B Testing?
  • Maximum Weight Node
  • Geek in a Maze
  • Kruskal-Wallis test in R Programming
  • Shortest path in a Binary Maze
  • How to perform a Nested ANOVA Test in Excel?

ANOVA, or Analysis of Variance, is a statistical method for comparing means among three or more groups, crucial in understanding group differences and relationships in diverse fields. In this article, we’ll focus on One-way ANOVA.

Table of Content

What is ANOVA?

Assumptions for anova, types of anova, how to perform one-way anova, one-way anova example, frequently asked questions (faqs).

ANOVA , or Analysis of Variance 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) based on their respective mean . ANOVA tests the null hypothesis that all group means are equal, against the alternative hypothesis that at least one group mean is different.

explain the hypothesis testing using one way of anova

  • The dependent variable is approximately normally distributed within each group. This assumption is more critical for smaller sample sizes.
  • The samples are selected at random and should be independent of one another.
  • All groups have equal standard deviations.
  • Each data point should belong to one and only one group. There should be no overlap or sharing of data points between groups.

In the case of two-way ANOVA , there are additional assumptions related to the interaction between the independent variables.

  • The effect of one independent variable on the dependent variable should be consistent across all levels of the other independent variable.
  • Combined effect of two independent variables is equal to the sum of their individual effects.

There are two main types of ANOVA:

  • One-way ANOVA : This is the most basic form of ANOVA and is used when there is only one independent variable with more than two levels or groups. It assesses whether there are any statistically significant differences among the means of the groups.
  • Two-way ANOVA : Extending the one-way ANOVA, two-way ANOVA involves two independent variables. It allows for the examination of the main effects of each variable as well as the interaction between them. The interaction effect explores whether the effect of one variable on the dependent variable is different depending on the level of the other variable.

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..

  • H0 -> μ1 = μ2 = μ3 (where μ = mean)
  • Ha -> At least one difference among the means.

Step 2 – Find the degree of freedom between and within the groups. [Using Eq-1 and Eq-2]

df_{\text{between}}=k-1 \;\;\; \cdots \text{ Equation-1}

  • n = number of samples in all groups combined
  • k = number of groups.

Then, find total degree of freedom. [Using Eq-3]

df_{total}=df_{\text{within}}+df_{\text{between}} \;\;\; \cdots \text{ Equation-3}

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.

F_{value}=\frac{\text{Variance}_{\text{between-samples}}} {\text{Variance}_{\text{within-samples}}} \;\;\; \cdots \text{ Equation-4}

Step 3 – Refer the F-Distribution table and find F table using df between and df within .

As per the given F-Distribution table,

df_1 = df_{\text{between}}  \\ df_2 = df_{\text{with in}}

[use the given value of α while referring the table.]

Step 4 – Find the mean of all samples in each group.

μ_{Grand}=\frac{\sum G}{n} \;\;\; \cdots \text{ Equation-5}

  • n = number of samples.

Step 5 – Find the sum of squares total using Eq-6 and sum of squares within using Eq-7.

SS_{Total}= \sum(x_i-\mu_{Grand})^2  \;\;\; \cdots \text{ Equation-6}

  • x i = i th sample.
  • μ i = mean of i th group.

Then find sum of squares between using Eq-8.

SS_{\text{between}}=SS_{Total}-SS{\text{with in}}  \;\;\; \cdots \text{ Equation-8}

Step 6 – Find the variance (μ 2 or S 2 ) between and within samples using Eq-9 and Eq-10 .

S^2_{\text{between}}=\frac{SS_{\text{between}}}{df_{\text{between}}}   \;\;\; \cdots \text{ Equation-9}

Step 7 – Find Fcalc using Eq-11.

F_{calc}=\frac{S^2{\text{between}}}{S^2{\text{with in}}}   \;\;\; \cdots \text{ Equation-11}

Interpreting the results

  • Don’t reject null hypothesis.

\mu_1 = \mu_2 =\mu_3

  • Reject null hypothesis.

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]

Step 1: Define the hypothesis

H_0 : \mu_E = \mu_M = \mu_S

Step 2: Degres of Freedom

As per the table, k = 3, n = 9

df_{between} =k-1= 3 - 1 = 2 \\ df_{within} =n-k= 9 - 3 = 6 \\ df_{total} =df_{between}+df_{within}= 2 + 6 = 8

Step 3 Find the F-value corresponding to Degree of Freedom and alpha

On referring to the F-Distribution table, using df1 = 2 and df2 = 6 at α = 0.05: we get, Ftable = 5.14

Step 4 Compute the mean

\mu_e = (2 + 4 + 2)/3 = (8/3) = 2.67 \\ \mu_m = (2 + 3 + 4)/3 = (9/3) = 3.00 \\ \mu_s = (1 + 2 + 5)/3 = (8/3) = 2.67 \\ \mu_{grand} = (8 + 8 + 9)/9 = (25/9) = 2.78

Step 5 Compute the Sum of Squares

\begin{aligned} SS_{Total}&= \sum(x_i-\mu_{Grand})^2  \\&=(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.60 \end{aligned}

Step 6 Find the variance

\begin{aligned} S^2_{\text{between}}&=\frac{SS_{\text{between}}}{df_{\text{between}}} \\&= \frac{0.23}{2}  \\&= 0.115 \approx 0.12 \end{aligned}

Step 7 Compute F-statistics

\begin{aligned} F_{calc}&=\frac{S^2{\text{between}}}{S^2{\text{with in}}} \\&= \frac{0.12}{2.22} \\&= 0.05   \end{aligned}

Since, Fcalc < Ftable (0.05 < 5.14)

We cannot reject the 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. 

Q. What is ANOVA used for?

It analyzes group variances to test differences in means, commonly applied in comparing group effects.

Q.How to use ANOVA using Python?

In Python, the scipy.stats module provides functions for ANOVA, and libraries like statsmodels offer comprehensive ANOVA capabilities.

Q. What is the role of ANOVA in EDA?

In Exploratory Data Analysis (EDA), ANOVA helps identify significant variations between groups, aiding insights into data patterns.

Q. What is the basic principle of ANOVA?

ANOVA compares means across groups, assessing if observed differences are statistically significant, using variances within and between groups.

Please Login to comment...

Similar reads.

  • Machine Learning

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

IMAGES

  1. Hypothesis Testing- Meaning, Types & Steps

    explain the hypothesis testing using one way of anova

  2. PPT

    explain the hypothesis testing using one way of anova

  3. Analysis of Variance (ANOVA) Explained with Formula, and an Example

    explain the hypothesis testing using one way of anova

  4. ANOVA One way

    explain the hypothesis testing using one way of anova

  5. One-way ANOVA

    explain the hypothesis testing using one way of anova

  6. Statistics One Way ANOVA Hypothesis Test-including StatCrunch

    explain the hypothesis testing using one way of anova

VIDEO

  1. Hypothesis Testing using One way ANOVA

  2. ANOVA one way

  3. #ANOVA two way Lec 01

  4. ANOVA in SPSS

  5. Chapter 09: Hypothesis testing: non-directional worked example

  6. Hypothesis testing using F Test Staistic in One Way ANOVA

COMMENTS

  1. One-way ANOVA

    ANOVA, which stands for Analysis of Variance, is a statistical test used to analyze the difference between the means of more than two groups. A one-way ANOVA uses one independent variable, while a two-way ANOVA uses two independent variables. As a crop researcher, you want to test the effect of three different fertilizer mixtures on crop yield.

  2. One Way ANOVA Overview & Example

    Use one way ANOVA to compare the means of three or more groups. This analysis is an inferential hypothesis test that uses samples to draw conclusions about populations. Specifically, it tells you whether your sample provides sufficient evidence to conclude that the groups' population means are different. ANOVA stands for analysis of variance.

  3. One-Way ANOVA: Definition, Formula, and Example

    One-Way ANOVA: The Process. A one-way ANOVA uses the following null and alternative hypotheses: H0 (null hypothesis): μ1 = μ2 = μ3 = … = μk (all the population means are equal) H1 (alternative hypothesis): at least one population mean is different from the rest. You will typically use some statistical software (such as R, Excel, Stata ...

  4. 11.1: One-Way ANOVA

    The F-test (for ANOVA) is a statistical test for testing the equality of \ (k\) population means. The one-way ANOVA F-test is a statistical test for testing the equality of \ (k\) population means from 3 or more groups within one variable or factor. There are many different types of ANOVA; for now, we are going to start with what is commonly ...

  5. One-Way ANOVA

    One-way ANOVA is a statistical method to test the null hypothesis ( H0) that three or more population means are equal vs. the alternative hypothesis ( Ha) that at least one mean is different. Using the formal notation of statistical hypotheses, for k means we write: H 0: μ1 = μ2 = ⋯ = μk H 0: μ 1 = μ 2 = ⋯ = μ k.

  6. One-way ANOVA

    The one-way analysis of variance (ANOVA) is used to determine whether there are any statistically significant differences between the means of three or more independent (unrelated) groups. This guide will provide a brief introduction to the one-way ANOVA, including the assumptions of the test and when you should use this test.

  7. One-Way ANOVA

    Conduct and interpret one-way ANOVA. The purpose of a one-way ANOVA test is to determine the existence of a statistically significant difference among several group means. The test actually uses variances to help determine if the means are equal or not. In order to perform a one-way ANOVA test, there are five basic assumptions to be fulfilled:

  8. 10: One-Way ANOVA

    A one-way between groups ANOVA is used to compare the means of more than two independent groups. A one-way between groups ANOVA comparing just two groups will give you the same results at the independent \(t\) test that you conducted in Lesson 8.We will use the five step hypothesis testing procedure again in this lesson.

  9. PDF Lecture 7: Hypothesis Testing and ANOVA

    The intent of hypothesis testing is formally examine two opposing conjectures (hypotheses), H0 and HA. These two hypotheses are mutually exclusive and exhaustive so that one is true to the exclusion of the other. We accumulate evidence - collect and analyze sample information - for the purpose of determining which of the two hypotheses is true ...

  10. 13.2: One-Way ANOVA

    Apr 2, 2023. Page ID. OpenStax. OpenStax. The purpose of a one-way ANOVA test is to determine the existence of a statistically significant difference among several group means. The test actually uses variances to help determine if the means are equal or not. To perform a one-way ANOVA test, there are several basic assumptions to be fulfilled:

  11. 1.2: The 7-Step Process of Statistical Hypothesis Testing

    Step 7: Based on steps 5 and 6, draw a conclusion about H0. If the F\calculated F \calculated from the data is larger than the Fα F α, then you are in the rejection region and you can reject the null hypothesis with (1 − α) ( 1 − α) level of confidence. Note that modern statistical software condenses steps 6 and 7 by providing a p p -value.

  12. Hypothesis Testing

    The hypothesis is based on available information and the investigator's belief about the population parameters. The specific test considered here is called analysis of variance (ANOVA) and is a test of hypothesis that is appropriate to compare means of a continuous variable in two or more independent comparison groups.

  13. ANOVA Test: Definition, Types, Examples, SPSS

    One Way ANOVA. A one way ANOVA is used to compare two means from two independent (unrelated) groups using the F-distribution. The null hypothesis for the test is that the two means are equal. Therefore, a significant result means that the two means are unequal. Examples of when to use a one way ANOVA

  14. One-way analysis of variance

    In statistics, one-way analysis of variance (or one-way ANOVA) is a technique to compare whether two or more samples' means are significantly different (using the F distribution).This analysis of variance technique requires a numeric response variable "Y" and a single explanatory variable "X", hence "one-way".. The ANOVA tests the null hypothesis, which states that samples in all groups are ...

  15. One-way ANOVA (cont...)

    Using the one-way ANOVA as a means to control the increase in Type 1 errors with multiple t-tests and understanding the assumptions underlying the test. ... See our guide on hypothesis testing for more information on Type I errors. Join the 10,000s of students, academics and professionals who rely on Laerd Statistics.

  16. Section 6.2: One-Way ANOVA Assumptions, Interpretation, and Write Up

    The following text represents how you may write up a One Way ANOVA: A one-way ANOVA was conducted to determine if levels of mental distress were different across employment status. Participants were classified into three groups: Full-time (n = 161), Part-time (n = 83), Casual (n = 123). There was a statistically significant difference between ...

  17. Hypothesis Testing

    ANOVA (Analysis of Variance) provides a statistical test of whether two or more population means are equal. Assume we want to determine whether multiple groups differ from one another in a ...

  18. One-way ANOVA in SPSS Statistics

    The one-way analysis of variance (ANOVA) is used to determine whether there are any statistically significant differences between the means of two or more independent (unrelated) groups (although you tend to only see it used when there are a minimum of three, rather than two groups). For example, you could use a one-way ANOVA to understand ...

  19. Analysis of variance (ANOVA)

    ANOVA 1: Calculating SST (total sum of squares) ANOVA 2: Calculating SSW and SSB (total sum of squares within and between) ANOVA 3: Hypothesis test with F-statistic. Analysis of variance, or ANOVA, is an approach to comparing data with multiple means across different groups, and allows us to see patterns and trends within complex and varied ...

  20. Understanding one-way ANOVA using conceptual figures

    The present article aims to examine the necessity of using a one-way ANOVA instead of simply repeating the comparisons using Student's t-test. ANOVA literally means analysis of variance, and the present article aims to use a conceptual illustration to explain how the difference in means can be explained by comparing the variances rather by the ...

  21. ANOVA: Complete guide to Statistical Analysis & Applications

    If our test returns a significant f-statistic, we may need to run a post-hoc test to tell us exactly which groups differ in means. Below I have mentioned the steps to perform one-way ANOVA in Microsoft Excel along with a post-hoc test. Step-by-Step to Perform One-Way ANOVA With Post-hoc Test. Step 1: Input your data into columns or rows in ...

  22. 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. ... Reject null hypothesis. One-Way ANOVA Example. 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 ...

  23. ANOVA 3: Hypothesis test with F-statistic

    ANOVA is inherently a 2-sided test. Say you have two groups, A and B, and you want to run a 2-sample t-test on them, with the alternative hypothesis being: Ha: µ.a ≠ µ.b. You will get some test statistic, call it t, and some p-value, call it p1. If you then run an ANOVA on these two groups, you will get an test statistic, f, and a p-value p2.