21. Interactions

Toothpaste and a fresh-orange-juice vending machine are shown above a plus sign. Below them, a man grimaces in disgust, illustrating that two individually pleasant experiences can produce an unpleasant result when combined.
Figure 1: An interaction: Toothpaste and orange juice may each be pleasant on their own, but orange juice consumed immediately after brushing often is gross. So the combined taste cannot be predicted by simply adding the separate effects of toothpaste and orange juice.

Motivating Scenario:

In multiple regression, we asked if each floral trait was associated with hybrid seed set after accounting for other traits. But biological traits do not always combine additively. A small white flower and a large white flower may not differ from pink flowers in the same way. Likewise, the relationship between petal area and hybrid seed set may depend on petal color, location, or another trait. In this chapter, we ask whether combinations of explanatory variables tell us something that each variable alone cannot.

Learning Goals: By the end of this chapter, you should be able to:

  • Explain what a statistical interaction means in words and in a figure.
  • Distinguish additive models from models with interactions.
  • Fit and interpret linear models with interaction terms.
  • Use plots and predicted values to understand interactions.
  • Evaluate whether an interaction improves a model.

Loading and cleaning data
ril_link <- "https://raw.githubusercontent.com/ybrandvain/datasets/refs/heads/master/clarkia_rils.csv"
rils <- readr::read_csv(ril_link) |>
  dplyr::select( ril, prop_hybrid, petal_area_mm, asd_mm, location, petal_color)|>
  na.omit()

To me, almost nothing is better than the fresh feeling after brushing with minty toothpaste each morning, except perhaps a large glass of freshly squeezed orange juice. The problem is that, although each is pleasant on its own, orange juice immediately after toothpaste is disgusting. Of course, it is not that two foods are always worse when combined, sometimes they are better. Think of classic combinations like peanut butter and jelly, wine and cheese, or the idea of food “pairings” more generally.


What does toothpaste + OJ have to do with Clarkia speciation?

You (probably)

In statistical terms, an interaction occurs when the association between one explanatory variable and the reponse depends on the value of another explanatory variable.

Interactions and the Origin of Species

It turns out that interactions play a key role in the origin of species. For example, the “Dobzhansky Muller Model” (Figure 2) argues that hybrid unfitness is due not to a “bad allele” in either species, but to mismatched combinations (aka DMIs) of alleles that have diverged since the initial population split.

In the context of our Clarkia floral phenotypes, we might want to know whether the extent of hybrid seed formation is better predicted by particular combinations of traits than by simply adding the effect of each trait in isolation.

A diagram of the Bateson–Dobzhansky–Muller model. An ancestral AABB genotype splits into two isolated populations. One evolves allele a and the other evolves allele b. When the populations hybridize, alleles a and b occur together for the first time and may be incompatible.
Figure 2: In the ancestral population the genotype is AABB. When two populations become isolated from each other, new mutations can arise. In one population A evolves into a, and in the other B evolves into b. When the two populations hybridise it is the first time a and b interact with each other. When these alleles are incompatible, we speak of DMIs.

Both the figure and caption are adapted from User:OrientationEB’s contribution to Wikipemedia commons and are licensed under CC BY-SA 4.0 attribution.

Although biological interactions like DMIs underlie the statistical interactions we study in this chapter, detecting a statistical interaction does not by itself reveal the underlying biological mechanism. Neither does the absence or a statistical interaction imply the absence of an interaction – for example we see no evidence of an interaction if only one allele is found at one locus. Reda more on statistical vs physiological epistasis here.


Envisioning interactions

Figure 3 shows cases in which Y is not (A and B), or is (C and D) associated with interactions between variables A and B. To make this less abstract, consider how this could relate to our Clarkia data. For example, Y could represent the proportion of hybrid seed, A could represent petal color, and B could represent flower size, simplified into “small” and “large.” If the lines are parallel (e.g. Figure 3 A and B), the association between petal color and the response is the same for small and large flowers. We might still see a main effect of petal color, a main effect of flower size, or both, but there is no interaction. If the lines are not parallel, the association between petal color and the response depends on flower size. For example, pink flowers might receive more visits than white flowers when flowers are large, but show little difference when flowers are small.

Four line plots show the response Y across two levels of A for two levels of B. In panel A, the two nearly overlapping lines both slope downward, showing a main effect of A. In panel B, two nearly horizontal parallel lines are separated vertically, showing a main effect of B. In panel C, one line rises while the other falls, with one level of B generally higher, showing both a main effect of B and an interaction. In panel D, the two lines cross, showing an interaction but no overall main effect.
Figure 3: Main effects and interactions between two categorical explanatory variables for four different statistical patterns.

Looking forward

Let’s go from these hypothetical plots to our actual data to see how main effects and interactions between our floral traits influence the proportion of hybrid seeds on a RIL.

This question could influence our interpretation of and expectations for floral phenotype evolving “to prevent hybridization.” For example, if white petals only decrease hybridization risk of large-petaled flowers we may see relatively weak selection favoring white flowers if petals are already small.

I am particularly interested in the interactions between petal color and petal area. But, I will also examine the interaction between petal color and location to provide an example of an interaction between two categorical variables. I will also explore the interaction between petal area and anther-stigma distance – but I honestly think anther stigma distance does not matter causally, and this is just a noisy stand in for petal color (see previous chapter).