# Two-way ANOVA using Minitab

## Introduction

The two-way ANOVA compares the effect of two categorical independent variables (called between-subjects factors) on a continuous dependent variable. In this sense, it is an extension of the one-way ANOVA. The common goal of a two-way ANOVA is to establish if there is an interaction between the two independent variables on the dependent variable. An interaction signifies that the effect of one of the two independent variables on the dependent variable is dependent on the other independent variable.

For example, you could use a two-way ANOVA to understand whether there is an interaction between physical activity level and gender on stress level (i.e., your dependent variable would be "stress score", measured on a continuous scale, and your independent variables would be "physical activity level", which has three groups – "low", "moderate" and "high" – and "gender", which has two groups: "males" and "females"). Alternately, you could use a two-way ANOVA to understand whether there is an interaction between physical activity level and gender on blood cholesterol concentration in children (i.e., your dependent variable would be "blood cholesterol concentration", measured on a continuous scale in mmol/L, and your independent variables would be "physical activity level", which has three groups – "low", "moderate" and "high" – and "gender", which has two groups: "males" and "females").

If you have a statistically significant interaction between your two independent variables on the dependent variable, it is possible to run "simple main effects" to determine the effect of one independent variable at each level of the other independent variable on the dependent variable (e.g., perhaps students with a PhD in the biological sciences had a higher mean salary than students with an undergraduate degree in psychology). We come back to "simple main effects" later.

In this "quick start" guide, we show you how to carry out a two-way ANOVA using Minitab, as well as interpret and report the results from this test. However, before we introduce you to this procedure, you need to understand the different assumptions that your data must meet in order for a two-way ANOVA to give you a valid result. We discuss these assumptions next.

## Assumptions

The two-way ANOVA has six assumptions. You cannot test the first three of these assumptions with Minitab because they relate to your study design and choice of variables. However, you should check whether your study meets these three assumptions before moving on. If these assumptions are not met, there is likely to be a different statistical test that you can use instead. Assumptions #1, #2 and #3 are explained below:

• Assumption #1: Your dependent variable should be measured at the continuous level. Examples of such continuous variables include height (measured in feet and inches), temperature (measured in °C), salary (measured in US dollars), revision time (measured in hours), intelligence (measured using IQ score), reaction time (measured in milliseconds), test performance (measured from 0 to 100), sales (measured in number of transactions per month), and so forth. If you are unsure whether your dependent variable is continuous (i.e., measured at the interval or ratio level), see our Types of Variable guide.
• Assumption #2: Your two independent variables should each consist of two or more categorical, independent (unrelated) groups. Examples of categorical variables include gender (e.g., 2 groups: male and female), ethnicity (e.g., 3 groups: Caucasian, African American and Hispanic), physical activity level (e.g., 4 groups: sedentary, low, moderate and high), and profession (e.g., 5 groups: surgeon, doctor, nurse, dentist, therapist).
• 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. If you do not have independence of observations, it is likely you have "related groups", which means you will need to use a two-way repeated measures ANOVA instead of the two-way ANOVA.

Assumptions #4, #5 and #6 relate to the nature of your data and can be checked using Minitab. You have to check that your data meets these assumptions because if it does not, the results you get when running a two-way ANOVA might not be valid. In fact, do not be surprised if your data violates one or more of these assumptions. This is not uncommon. However, there are possible solutions to correct such violations (e.g., transforming your data) such that you can still use a two-way ANOVA. Assumptions #4, #5 and #6 are explained below:

• Assumption #4: There should be no significant outliers. An outlier is simply a single case within your data set that does 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 two-way ANOVA, reducing the accuracy of your results. Fortunately, when using Minitab to run a two-way ANOVA on your data, you can easily detect possible outliers.
• Assumption #5: Your dependent variable should be approximately normally distributed for each combination of the groups of the two independent variables. Your data need only be approximately normal for running a two-way ANOVA because it is quite "robust" to violations of normality, meaning that this assumption can be a little violated and still provide valid results. You can test for normality using the Shapiro-Wilk test for normality, which is easily tested for using Minitab.
• Assumption #6: There needs to be homogeneity of variances for each combination of the groups of the two independent variables. You can test this assumption in Minitab using Levene's test for homogeneity of variances.

In practice, checking for assumptions #4, #5 and #6 will probably take up most of your time when carrying out a two-way ANOVA. However, it is not a difficult task, and Minitab provides all the tools you need to do this.

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

## Example

A researcher was interested in whether an individual's interest in politics was influenced by their level of education and gender. Therefore, the dependent variable was "interest in politics", and the two independent variables were "gender" and "level of education".

In particular, the researcher wanted to know whether there was an interaction between education level and gender. Put another way, was the effect of level of education on interest in politics different for males and females?

To answer this question, a random sample of 60 participants were recruited to take part in the study – 30 males and 30 females – equally split by level of education: school, college and university (i.e., 10 participants in each group). Each participant in the study completed a questionnaire that scored their interest in politics on a scale of 0 to 100, with higher scores indicating a greater interest in politics.

Participants' interest in politics was recorded in the variable, Interest in Politics, their gender in the variable, Gender, and their level of education in the variable, Educational Level. In variable terms, the researcher wanted to know if there was an interaction between Gender and Educational Level on Interest in Politics.

## Setup in Minitab

In Minitab, we set up the three variables in columns , and . Therefore, under column we entered the name of the dependent variable, Interest in Politics, as follows: . Then, under column we entered the name of the first independent variable, Gender, as follows: . Next, under column we entered the name of the second independent variable, Educational Level, as follows: . Finally, we entered: (a) the scores on the dependent variable, interest in politics, for each participant scores into the Interest in Politics column; (b) the gender of each participant – "Male" or "Female" – into the Gender column; and (c) the educational level of each participant – "School", "College" or "University" – into the Educational Level column. This is illustrated below:

Published with written permission from Minitab Inc.

Note: You can also enter variables in numeric form. For example, in cells under the Gender column, you could enter "1" instead of "Male" and "2" instead of "Female" (i.e., assuming that you decided to code "Male" as "1" and "Female" as "2").

## Test Procedure in Minitab

In this section, we show you how to analyse your data using a two-way ANOVA in Minitab when the six assumptions in the previous section, Assumptions, have not been violated. The procedure changed from Minitab 16 to Minitab 17. Therefore, we present the procedure for both below:

### Minitab 16

1. Click Stat > ANOVA > Two-Way... on the top menu, as shown below:

Published with written permission from Minitab Inc.

You will be presented with the following Two-Way Analysis of Variance dialogue box:

Published with written permission from Minitab Inc.

Note: The dependent variable will already be present in the main left-hand box (e.g., C1   Interest in Politics).

2. Transfer the dependent variable, Interest in Politics, into the Response: box, as shown below:

Published with written permission from Minitab Inc.

Note: To transfer the dependent variable into the Response: box, simply double click on it in the main left-hand box (e.g., C1   Interest in Politics). Alternately, you can click on the dependent variable once, which will activate the button (it is usually faded: ), and then click on the button. Your cursor should automatically be in the Response: box when you open the Two-Way Analysis of Variance dialogue box for the first time, but if not, you will first have to put your cursor into the Response: box before you transfer the dependent variable.

3. Enter the first of the two independent variables, Gender, into the Row factor: box, and the second independent variable, Educational Level, into the Column factor: box.

Published with written permission from Minitab Inc.

Note 1: To transfer the independent variables, you first need to click into the relevant boxes – either the Row factor: box or the Column factor: box – for your independent variables to appear in the main left-hand box (i.e., C2   Gender and C3   Educational Level) (N.B., you will notice that there may be other variables in this main left-hand box in addition to your two independent variables, but you can just ignore these). You can now either select the variable you want to transfer (e.g., C2   Gender in the main left-hand box into the Row factor: box) by double-clicking on it or using the button, as you did in Step 2 above.

Note 2: By default, Minitab uses 95% confidence intervals, which equates to declaring statistical significance at the p < .05 level. If you want to change the value of the confidence interval, simply enter the new value into the Confidence level: box (e.g., a value of 99.0 would equate to declaring statistical significance at the p < .01 level), highlighted in red below:

4. Click on the button. The output that Minitab produces is shown below.

### Minitab 17

1. Click Stat > ANOVA > General Linear Model > Fit General Linear Model... on the top menu, as shown below:

Published with written permission from Minitab Inc.

You will be presented with the following General Linear Model dialogue box:

Published with written permission from Minitab Inc.

Note: The dependent variable will already be present in the main left-hand box (e.g., C1   Interest in Politics).

2. Transfer the dependent variable, Interest in Politics, into the Response: box, as shown below:

Published with written permission from Minitab Inc.

Note: To transfer the dependent variable into the Responses: box, simply double click on it in the main left-hand box (e.g., C1   Interest in Politics). Alternately, you can click on the dependent variable once, which will activate the button (it is usually faded: ), and then click on the button. Your cursor should automatically be in the Responses: box when you open the General Linear Model dialogue box for the first time, but if not, you will first have to put your cursor into the Responses: box before you transfer the dependent variable.

3. Transfer the two independent variables, Gender and Educational Level, into the Factors: box, as shown below:

Published with written permission from Minitab Inc.

Note: To transfer the independent variables, you first need to click into the Factors: box for your independent variables to appear in the main left-hand box (i.e., C2   Gender and C3   Educational Level) (N.B., you will notice that there may be other variables in this main left-hand box in addition to your two independent variables, but you can just ignore these). You can now either select the variables you want to transfer (e.g., C2   Gender and C3   Educational Level) in the main left-hand box into the Factors: box) by double-clicking on them or using the button, as you did in Step 2 above.

4. Click on the button. You will be presented with the General Linear Model: Model dialogue box, as shown below:

Published with written permission from Minitab Inc.

5. Highlight both independent variables in the Terms in the model: box by clicking on them whilst holding down the shift-key. You will be presented with the following screen:

Published with written permission from Minitab Inc.

6. Click on the second button (i.e., the button on the Cross factors, covariates, and terms in the model line). This will add the interaction term between the two independent variables into the Terms in the model: box, as shown below:

Published with written permission from Minitab Inc.

7. Click on the button and you will be returned to the General Linear Model dialogue box.
8. Click on the button. The output that Minitab produces is shown below:

## Output of the two-way ANOVA in Minitab

The Minitab 16 output for a two-way ANOVA is shown below:

And for Minitab 17 it is very similar (only the output relevant for this guide is shown here):

Both tables shown the effect of Gender, Educational Level and their interaction (i.e., the "Interaction" row in Minitab 16 and the "Gender*Educational Level" row in Minitab 17). The most important effect, and the effect you should look at first, is the interaction effect. You can see that the interaction effect is statistically significant because p = .0014 (i.e., the value in the "P" and "P-Value" columns in Minitab 16 and 17, respectively). You may want to report the results of Gender and Educational Level as well, but in the presence of an interaction, they are seldom interpreted and reported. The meaning of a statistically significant interaction is that the effect of Gender on Interest in Politics is dependent on Education Level (and vice versa); that is, the effect of Education Level on Interest in Politics is dependent on Gender. Due to this statistically significant interaction, you will also need to report simple main effects; that is, the effect of an independent variable at each level of the other independent variable. In our example, this would involve determining the mean difference in interest in politics between genders at each educational level, as well as between educational level for each gender (e.g., perhaps females with a university education had a greater interest in politics than males with a school education). Alternately, if you do not have a statistically significant interaction, you can report the main effects instead. Both the simple main effects and main effects can be calculated using Minitab.

Note: We present the output from the two-way ANOVA above. However, since you should have tested your data for the assumptions we explained earlier in the Assumptions section, you will also need to interpret the Minitab output that was produced when you tested for them. This includes: (a) the boxplots you used to check if there were any significant outliers; (b) the output Minitab produces for your Shapiro-Wilk test for normality to determine normality; and (c) the output Minitab produces for your Levene's test to determine whether there are homogeneity of variances. Also, remember that if your data failed any of these assumptions, the output that you get from the two-way ANOVA procedure (i.e., the output we discuss above) might no longer be valid, and you will need to interpret the Minitab output that is produced when they fail (i.e., this includes different results).

## Reporting the output of the two-way ANOVA

When you report the output of your two-way ANOVA, it is good practice to include:

• A. An introduction to the analysis you carried out.
• B. Information about your sample (including how many participants were in each of your groups if the group sizes were unequal or there were missing values).
• C. A statement of whether there was a statistically significant interaction between your two independent variables on the dependent variable, including the observed F-value (F or F-Value in Minitab 16 or 17, respectively), degrees of freedom (DF), and significance level, or more specifically, the 2-tailed p-value (P or P-Value in Minitab 16 or 17, respectively).
• D. If the interaction was statistically significant, a statement dealing with the results of "simple main effects".

Based on the Minitab output above, we could report the results of this study as follows (N.B., we have also included an example of a simple main effect):

• General

A two-way ANOVA was run on a sample of 60 participants to examine the effect of gender and education level on interest in politics. There was a significant interaction between the effects of gender and education level on interest in politics, F (2, 54) = 4.64, p = .014. Simple main effects analysis showed that males were significantly more interested in politics than females when educated to university level (p = .002), but there were no differences between gender when educated to school (p = .465) or college level (p = .793).

Portions of information contained in this publication/book are printed with permission of Minitab Inc. All such material remains the exclusive property and copyright of Minitab Inc. All rights reserved.