Skip to main content
Statistics LibreTexts

10.1: Looking at main effects and interactions

  • Page ID
    7947
  • \( \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{\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{\AA}{\unicode[.8,0]{x212B}}\)

    Designs with multiple factors are very common. When you read a research article you will often see graphs that show the results from designs with multiple factors. It would be good for you if you were comfortable interpreting the meaning of those results. The skill here is to be able to look at a graph and see the pattern of main effects and interactions. This skill is important, because the patterns in the data can quickly become very complicated looking, especially when there are more than two independent variables, with more than two levels.

    2x2 designs

    Let’s take the case of 2x2 designs. There will always be the possibility of two main effects and one interaction. You will always be able to compare the means for each main effect and interaction. If the appropriate means are different then there is a main effect or interaction. Here’s the thing, there a bunch of ways all of this can turn out. Check out the ways, there are 8 of them:

    1. no IV1 main effect, no IV2 main effect, no interaction
    2. IV1 main effect, no IV2 main effect, no interaction
    3. IV1 main effect, no IV2 main effect, interaction
    4. IV1 main effect, IV2 main effect, no interaction
    5. IV1 main effect, IV2 main effect, interaction
    6. no IV1 main effect, IV2 main effect, no interaction
    7. no IV1 main effect, IV2 main effect, interaction
    8. no IV1 main effect, no IV2 main effect, interaction

    OK, so if you run a 2x2, any of these 8 general patterns could occur in your data. That’s a lot to keep track of isn’t. As you develop your skills in examining graphs that plot means, you should be able to look at the graph and visually guesstimate if there is, or is not, a main effect or interaction. You will need you inferential statistics to tell you for sure, but it is worth knowing how to know see the patterns.

    In this section we show you some example patterns so that you can get some practice looking at the patterns. First, in bar graph form. Note, we used the following labels for the graph:

    • 1 = there was a main effect for IV1.
    • ~1 = there was not a main effect for IV1
    • 2 = there was a main effect for IV2
    • ~2 = there was not a main effect of IV2
    • 1x2 = there was an interaction ` ~1x2 = there was not an interaction
    library(ggplot2)
    p1<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,5,5,5))
    p2<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,10,5,5))
    p3<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,13,5,2))
    p4<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,10,15))
    p5<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,18,5,7))
    p6<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,5,10))
    p7<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(2,12,5,9))
    p8<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,10,5))
    all_22s <- rbind(p1,p2,p3,p4,p5,p6,p7,p8)
    type <- c(rep("~1, ~2, ~1x2",4),
              rep("1, ~2, ~1x2",4),
              rep("1, ~2, 1x2",4),
              rep("1, 2, ~1x2",4),
              rep("1, 2, 1x2",4),
              rep("~1, 2, ~1x2",4),
              rep("~1, 2, 1x2",4),
              rep("~1, ~2, 1x2",4))
    type<-as.factor(type)
    all_22s <- cbind(all_22s,type)
    ggplot(all_22s, aes(x=IV1, y=means, group=IV2, fill=IV2))+
      geom_bar(stat="identity", position="dodge")+
      theme_classic()+
      facet_wrap(~type, nrow=2)+
      theme(legend.position = "top")
    Figure \(\PageIndex{1}\): 8 Example patterns for means for each of the possible kinds of general outcomes in a 2x2 design.

    Next, we show you the same thing in line graph form:

    library(ggplot2)
    p1<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,5,5,5))
    p2<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,10,5,5))
    p3<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,13,5,2))
    p4<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,10,15))
    p5<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(10,18,5,7))
    p6<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,5,10))
    p7<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(2,12,5,9))
    p8<- data.frame(IV1 = c("A","A","B","B"),
                    IV2 = c("1","2","1","2"),
                    means = c(5,10,10,5))
    all_22s <- rbind(p1,p2,p3,p4,p5,p6,p7,p8)
    type <- c(rep("~1, ~2, ~1x2",4),
              rep("1, ~2, ~1x2",4),
              rep("1, ~2, 1x2",4),
              rep("1, 2, ~1x2",4),
              rep("1, 2, 1x2",4),
              rep("~1, 2, ~1x2",4),
              rep("~1, 2, 1x2",4),
              rep("~1, ~2, 1x2",4))
    type<-as.factor(type)
    all_22s <- cbind(all_22s,type)
    ggplot(all_22s, aes(x=IV1, y=means, group=IV2, color=IV2))+
      geom_point()+
      geom_line()+
      theme_classic()+
      facet_wrap(~type, nrow=2)+
      theme(legend.position = "top")
    Figure \(\PageIndex{2}\): Line graphs showing 8 possible general outcomes for a 2x2 design.

    You might find the line graphs easier to interpret. Whenever the lines cross, or would cross if they kept going, you have a possibility of an interaction. Whenever the lines are parallel, there can’t be an interaction. When both of the points on the A side are higher or lower than both of the points on the B side, then you have a main effect for IV1 (A vs B). Whenever the green line is above or below the red line, then you have a main effect for IV2 (1 vs. 2). We know this is complicated. You should see what all the possibilities look like when we start adding more levels or more IVs. It gets nuts. Because of this nuttiness, it is often good practice to make your research designs simple (as few IVs and levels as possible to test your question). That way it will be easier to interpret your data. Whenever you see that someone ran a 4x3x7x2 design, your head should spin. It’s just too complicated.


    This page titled 10.1: Looking at main effects and interactions is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew J. C. Crump via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.