Two-Way ANOVA using SPSS Tutorial

Nikki Kamouneh

Posted on
ANOVA SPSS Sum of Squares Two-Way

This tutorial is going to take the theory learned in our Two-Way ANOVA tutorial and walk through how to apply it using SPSS. We will use the Moore dataset which can be downloaded using this from the Scilab website.

The data is from an experimental study which consists of subjects in a “social-psychological experiment who were faced with manipulated disagreement from a partner of either of low or high status. The subjects could either conform to the partner’s judgment or stick with their own judgment.” (John Fox, Sanford Weisberg and Brad Price (2018). carData: Companion to Applied Regression Data Sets. R package version 3.0-2.

We are interested in exploring an individuals conformity based on their partner’s status:

  • Low
  • High

We are also interested in exploring whether their F-score category (a measure of authoritarianism) affects outcomes or interacts with partner status. The three factor levels are:

  • Low
  • Medium
  • High

Our sample size is \(N = 45\). First, let’s inspect the data for outliers or funky distributions by creating a boxplot of conformity scores within each combination of partner.status and fcategory. To create the boxplot in SPSS, go to Graphs \(\rightarrow\) Chart Builder…

Create boxplot in SPSS

The Chart Builder window will open. Select Boxplot.

Create boxplot in SPSS

Click and drag the second option (clustered) to the Chart Preview window.

Creating boxplot in SPSS

Right click on the conformity variable and change it’s type to Scale (if it’s not already), then click and drag conformity to the y-axis box. Then click and drag fcategory to the x-axis, and partner.status to the cluster on x box.

Creating boxplot in SPSS

Note how the order of variables on the x-axis is automatically alphabetical. We want to change this to read “Low, Medium, High”. Do this by selecting the x-axis. Then we will use the arrows to adjust the Order.

Creating boxplot in SPSS

Then click OK. This is our output plot:

Boxplot of conformity by F-score category by partner status

This figure allows us to get a sense of the distribution of the outcome within each factor level, though it makes it a little difficult to immediately see if an interaction is present. An interaction plot will provide this information for us. We can request the interaction when we run the actual ANOVA. We do this in SPSS by going to Analyze \(\rightarrow\) General Linear Model \(\rightarrow\) Univariate.


We select conformity as our Dependent Variable, and partner.status and fcategory as our Fixed Factor(s). Then click on Model…


The Univariate Model window will open. Verify that the Full Factorial button is selected. This tells SPSS to estimate the model that has both main effects plus the interaction.


Then click Continue.

Next, we’ll request an interaction plot. This will show the means for the outcome within each level of one of the factors, with separate lines for the other factor. In an interaction plot, parallel lines indicate that no interaction is present because the mean differences in the first factor are the same regardless of the level of the other factor. Non-parallel lines mean that an interaction is likely present. In other words, the mean differences on the first factor depend on the the level of the second factor.

Click Plots… to open the Univariate: Profile Plots window. We will create two plots. One of fcategory by partner.status, and one of partner.status by fcategory. Looking at both will allow us to investigate the interaction from two perspectives.


Select partner.status for the Horizontal Axis and fcategory for Separate Lines, then click Add. Next, select fcategory for the Horizontal Axis and partner.status for Separate Lines. Click Add again. You will have two plots:


Click Continue, then click OK.

The first thing to investigate is the significance of the interaction. If it is non-significant, we can proceed to looking at the main effects. However, if the interaction is significant, the main effects will not be very helpful, as we will need to explore when each factor is significant given levels of the other factor. The significance tests appear in the Test of Between-Subjects Effects table:


This table gives us:

  • Type III Sum of Squares: The sum of squared errors for each model term
  • df: The degree of freedom
  • Mean Square: \(\frac{SS}{df}\)
  • F: The F statistic for each variable
  • Sig.: The p-value associated with each term (\(\lt 0.05\) indicates significance)

We find \(p = 0.002\) for partner.status and \(p = 0.431\) for fcategory. Most importantly, we see that \(p = 0.023\) for partner.status*fcategory. This tells us that the effect of partner status will depend on levels of F-category, or vice versa. The next step is to determine when each factor is significant.

We can get a visual sense of the interaction by looking at the interaction plots we requested:

Estimated Marginal Means Plot

Estimated Marginal Means Plot

The top figure shows us that, among those in the fcategory = high group, the effect of partner.status is small; the line is relatively horizontal. However, when fcategory = low or fcategory = medium, the effect of partner.status is pronounced; the means are different when moving from partner.status = high to partner.status = low.

The bottom figure shows us the interaction from a different perspective. We see that the effect of fcategory is different depending on if we’re talking about those with partner.status = high or partner.status = low.

What neither figure tells us is which of these effects is significant. For example, in the top figure we saw that the effect of partner.status appeared weak among the factory = high group, but it was larger for the other two fcategory levels. Perhaps partner.status has a significant effect on conformity, but only when fcategory is not high. To test this, we’ll need to perform something akin to a one-way ANOVA for partner.status within each level of fcategory. However, the correct F-test will utilize all of the information from the full two-way factorial model. To get this test, it is necessary to use SPSS syntax.

To run the model with syntax, start out using the menus to set up the model just like we did above. However, once we are ready to run the model we will click on Paste instead of OK. The syntax editor will open with the syntax to run the model like we did before.

Running SPSS ANOVA with syntax

Add the following line of syntax:

/EMMEANS=TABLES(partner.status*fcategory) COMPARE(partner.status) .

The syntax should look something like:

Running ANOVA with SPSS syntax

Highlight everything and click Run.

Look for the table named Univariate Tests to find the specific tests we requested in the syntax.

SPSS ANOVA results

The table tells us that partner.status is indeed significant when fcategory is low or medium, but not when it is high. Consequently, we can follow up with pairwise comparisons for partner.status within the two significant fcategory levels. We’ll see this in the Pairwise Comparisons table.

SPSS Pairwise Comparisons

With only two levels of the partner.status factor, this table isn’t really necessary. It is more informative when we want to do post hoc pairwise comparisons of more than two levels given. This would be the case if we assessed the effect of fcategory within levels of partner.status. To do this, we make a slight change to our syntax, swapping out partner.status with fcategory in the COMPARE () function:

SPSS Syntax

Looking again at the Univariate Tests box:

Univariate Tests Results

We do not find a significant result for the joint tests that 1) all fcategory means are equal when partner.status = low, and 2) all fcategory means are equal when partner.status = high. If we did, we would again turn to the pairwise comparisons table to identify which means were significantly different given each partner.status level.

Still have questions? Contact us!