Course Outline

list High School / Statistics and Data Science II (XCD)

Book High School / Statistics and Data Science II (XCD)
  • High School / Advanced Statistics and Data Science I (ABC)
  • High School / Statistics and Data Science I (AB)
  • High School / Statistics and Data Science II (XCD)
  • High School / Algebra + Data Science (G)
  • College / Introductory Statistics with R (ABC)
  • College / Advanced Statistics with R (ABCD)
  • College / Accelerated Statistics with R (XCD)
  • CKHub: Jupyter made easy

9.3 Representing the Interaction Model in GLM Notation

The Interaction Model in GLM Notation

In the additive model, we constrain the slopes of the two regression lines to be the same, but allow the two lines to have different y-intercepts depending on condition. We accomplish this by adding another term to the model that adjusts the y-intercept up or down if the patient is in the dog group (b1Dogi in the additive model, below).

Additive model: lateri=b0+b1Dogiadjustmentto y-interceptwhen Dog=1+b2basei

In the interaction model, we allow the two lines to have different slopes (as well as different y-intercepts) depending on condition. To make the slope differ based on condition, we can add another term to the model that adjusts the slope when Dogi=1 in much the same way we did for the y-intercept.

Interaction model: lateri=b0+b1Dogi+b2basei+b3Dogibaseinew term+ei

This new term, which includes the product of two variables (Dogibasei), is called the interaction term. The other components of the interaction model (b0+b1Dogi+b2basei) should look familiar because we have already studied the additive model. Let’s take a closer look to see how adding this new term can give us a way to adjust the slope from one group to the next.

Interaction model: lateri=b0+b1Dogiadjustmentto y-interceptwhen Dog=1+b2basei+b3Dogiadjustmentto slopewhen Dog=1basei

Writing Simple Expressions

We know that the model predictions for the interaction model can be represented as two straight lines, each with its own y-intercept and slope. But it is not always easy to see the two lines when they are embedded in the complete model.

One way to help us see the two lines in the complete model is to write a separate model statement for patients in each group: Control and Dog. We will call these simplified model statements simple expressions.

Here, again, is the complete interaction model:

b0+b1Dogi+b2basei+b3Dogibasei

Notice that Dogi doesn’t appear in any of these simple expressions. Because we have generated separate expressions for each group, we don’t need to include condition (i.e., Dogi) in the expressions.

Let’s focus in on the simple expression for the control condition:

b0+b2basei

We can begin to summarize how to interpret the parameter estimates of the interaction model by filling in the first row of the table below.

condition y-intercept slope
Control b0 b2
Dog

It stands to reason that if we look at the simple expression for the dog condition, we should be able to see that it too is an equation of a line (it would just have a different y-intercept and a different slope). Let’s delve into that:

b0+b1+b2basei+b3basei

Although these bs look like they are “variables” – they are actually numbers that don’t vary (we can easily get them by using lm()). That’s why we call them coefficients rather than variables. The only true variable here is basei. We can combine the two terms that have basei in them (i.e., b2basei+b3basei) into this: (b2+b3)basei

Here’s how we would re-write the simple expression for the dog condition: (b0+b1)+(b2+b3)basei

Now we can fill in the rest of our table:

condition y-intercept slope
Control b0 b2
Dog b0+b1 b2+b3

These y-intercepts and slopes fit into the simple expressions like this:

Control group model: b0+b2basei

Dog group model: (b0+b1)y-intercept+(b2+b3)slopebasei

The b0 parameter estimate is the y-intercept for the Control group, whereas the b1 estimate is the adjustment, up or down, that must be made to get from the y-intercept of the Control group to that of the Dog group.

The b2 and b3 estimates in the interaction model work in exactly the same way, but for slopes. b2 is the slope of the regression line for the Control group. b3, the parameter estimate for our new interaction term, is the adjustment in slope, up or down, that should be made to get the slope of the regression line for patients in the Dog group.

Responses