A **two-way ANOVA** is used to determine whether or not there is a statistically significant difference between the means of three or more independent groups that have been split on two factors.

The purpose of a two-way ANOVA is to determine how two factors impact a response variable, and to determine whether or not there is an interaction between the two factors on the response variable.

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

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

In this example we will use the built-in Stata dataset called *systolic *to perform a two-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 two-way ANOVA to find out if the type of drug used and the patient’s disease type has 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 two-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: Perform a two-way ANOVA.**

Along the top menu bar, go to **Statistics > Linear models and related > ANOVA/MANOVA > Analysis of variance and covariance**.

For Dependent variable, choose *systolic*. Then, click the three dots … next to the dropdown arrow under *Model*.

You will be presented with a new screen. Keep *Factor variable *selected. For Specification, choose *2-way full factorial* since we are conducting a two-way ANOVA. For variable 1, choose *drug *and use *Default *for the Base. For variable 2, choose *disease *and use *Default *for the Base. Then, click *Add to varlist *at the bottom. Then, click *OK*.

The original window will appear with drug##disease now filled in under *Model*. You don’t need to do anything here again. Simply click *OK*.

The results of the two-way ANOVA will automatically appear:

From the output we can observe the following:

- There is no significant interaction between drug and disease (p-value = 0.3958)
- Disease has no significant effect on systolic blood pressure (p-value = 0.1637)
- Drug has a statistically significant effect on systolic blood pressure (0.0001)

**Step 4: Report the results.**

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

A two-way ANOVA was conducted on 58 individuals to examine the effect that drug and disease has on systolic blood pressure.

There was no significant interaction between the effects of drug and disease on systolic blood pressure (p = 0.3958). There was no significant effect of disease on systolic blood pressure (p = 0.1637). There was a significant effect of drug on systolic blood pressure (0.0001).