*31*

AÂ one-way ANOVAÂ is used to determine whether or not there is a statistically significant difference between the means of three or more independent groups.

This type of test is called aÂ *one-way*Â ANOVA because we are analyzing howÂ *oneÂ *predictor variable impacts a response variable. If we were instead interested in how two predictor variables impact a response variable, we could conduct aÂ *two-wayÂ *ANOVA.

This tutorial explains how to conduct a one-way ANOVA in Stata.

**Example: One-Way ANOVA in Stata**

In this example we will use the built-in Stata dataset calledÂ *systolicÂ *to perform a one-way ANOVA. This dataset contains the following three variables for 58 different individuals:

- Drug used
- Patientâ€™s disease
- Change in systolic blood pressure

We will use the following steps to perform a one-way ANOVA to find out if the type of drug used leads to a significant impact in the change in systolic blood pressure.

**Step 1: Load the data.**

First, load the data by typingÂ **webuse systolicÂ **in the command box and clicking Enter.

**Step 2: View the raw data.**

Before we perform a one-way ANOVA, letâ€™s first view the raw data. Along the top menu bar, go toÂ **Data > Data Editor > Data Editor (Browse)**. This will show us the actual data for all 58 patients:

**Step 3: Visualize the data.**

Next, letâ€™s visualize the data. Weâ€™ll create boxplotsÂ to view the distribution of systolic blood pressure values for each category of drug.

Along the top menu bar, go toÂ **Graphics > Box plot**. Under variables, choose Systolic:

Then, in the Categories subheading under Grouping variable, choose drug:

Click *OK*. A chart with four boxplots will automatically be displayed:

We can immediately see that the distribution of changes in systolic blood pressure vary between the drug categories, but a one-way ANOVA will tell us if these differences are statistically significant.

**Step 4: Perform a one-way ANOVA.**

Along the top menu bar, go toÂ **Statistics > Linear models and related > ANOVA/MANOVA > One-Way ANOVA**.

Under response variable, choose systolic. Under factor variable, choose drug. Then click the box next to *Produce summary table* so that we can see some basic descriptive statistics for each group. Then clickÂ *OK*.

The following output will be displayed:

The F-statistic isÂ **9.09Â **and the corresponding p-value isÂ **0.0001**. Since the p-value is less than alpha = 0.05, we can reject the null hypothesis that the mean change in systolic blood pressure for each group is equal.

In other words, there is a statistically significant difference in the mean change in systolic blood pressure between at least two of the drug groups.

**Step 5: Perform multiple comparison tests.**

Next, we can perform multiple comparison tests to actually find out which group means are different from each other.

Along the top menu bar, go toÂ **Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Pairwise comparisons of** **means**.

For Variable, choose the response variable *systolic*. For Over, choose the explanatory variable *drug*. For Multiple comparisons adjustment, chooseÂ *Tukeyâ€™s method*.

Then, under the *Reporting* subheading click the button next toÂ *Effects tablesÂ *and check the box next toÂ *Show effects table with confidence intervals and p-values*. Then clickÂ *OK*.

The following results will be displayed:

Each row represents a comparison between two specific drug groups. For example, the first row compares the mean systolic blood pressure change between drug group 2 and drug group 1. The p-value for this comparison isÂ **0.999**, which is extremely high and not smaller than 0.05. This means there is no statistically significant difference between drug groups 1 and 2.

However, we can see that the p-values for the following comparisons are all less than 0.05:

- drug 3 vs. 1 | p-value =Â
**0.001** - drug 4 vs. 1 | p-value =Â
**0.010** - drug 3 vs. 2 | p-value =Â
**0.001** - drug 4 vs. 2 | p-value =Â
**0.015**

This means that the difference in mean systolic blood pressure change is statistically significant between each of these groups.

**Step 6: Report the results.**

Lastly, we will report the results of our One-Way ANOVA analysis. Here is an example of how to do so:

A one-way ANOVA was performed to determine if four different types of drugs had different impacts on systolic blood pressure.

The following table summarizes the number of participants in each group along with the mean change in systolic blood pressure and the standard deviation in systolic blood pressure for each group:

A one-way ANOVA revealed that there was a statistically significant difference between at least two groups (F(3, 54) = 9.09, p = 0.001).

Tukeyâ€™s test for multiple comparisons found that the change in systolic blood pressure was statistically significantly higher for drug 3 compared to drug 1 (17.32 +/- 4.15, p = 0.001), for drug 3 compared to drug 2 (16.78 +/- 4.15, p = 0.001), for drug 4 compared to drug 1 (12.57 +/- 3.85, p = 0.010), and for drug 4 compared to drug 2 (12.03 +/- 3.85, p = 0.015).

There was no statistically significant difference between drug groups 1 and 2 (.533 +/- 3.91, p = 0.999) or between drug groups 3 and 4 (4.75 +/- 4.09, p = 0.654).