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}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    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.