# Interaction in generalized linear model

I have 2 continuous variables as my predictors and the interaction between them, so 3 effects all together (when I center my predictors only the interaction is significant). I am using a binary logit model except where I have fixed the value of the number of trials at 20, for my dependent variable. My problem has to do with further understanding the nature of the interaction. I know that in generalized linear models the interaction is more complex compared to the linear model because of the link function. I have read that interpreting the sign of the parameter estimates is very limited, so I am trying to find a way to further understand the interaction, and graphing it would be nice as well. Unfortunately, I only have SPSS at my disposal. Jeff Gill (http://www.artsci.wustl.edu/~jgill/papers/interactions3.pdf) wrote about a method called first differences which seems very similar to the inteff command in stata. If anybody could tell me how to how to further understand and test the interaction in a generalized linear model using spss or hand calculations I would be eternally grateful.

In general, the existence of an interaction means that the effect of one variable depends on the value of the other variable with which it interacts. If there isn't an interaction, then the value of the other variable doesn't matter.

This is easiest to understand in the case of linear regression. Imagine we are looking at the adult height (say at 25) of a child based on the adult height of the father. We further include sex as an additional predictor variable, because men and women differ considerably in adult height. Let's imagine that there is no interaction between these two variables (which may be true, at least to a first approximation). We could then plot our model simply as two lines on a scatterplot of the data. We may want to use different colors or symbols / line styles for men vs. women, but at any rate we would see a football-ish (or rugby-ball-ish, depending on where you live) shaped cloud of points with two parallel lines going through it. The important part is that the lines are parallel; if someone asked you what the effect would be of the father being 1 inch (1 cm) taller, you would respond with $\beta_{\text{height}}$. If they further asked you what the effect would be if the child were male or female, you would respond, 'that doesn't matter, you would expect them to be $\beta_{\text{height}}$ taller as an adult either way'. That is because the lines are parallel (with the same slope, $\beta_{\text{height}}$) / there is no interaction.

Now imagine the case of anxiety on test taking performance when examining two populations: emotionally stable vs. emotionally unstable people. Lets imagine that there is an interaction such that emotionally unstable people are more strongly affected by anxiety. Then, if we plotted the model similarly, we would see two lines that are not parallel. One line (representing emotionally stable individuals) might be sloping downward gradually, while the other line (representing unstable students) might move downward much more quickly. If we had used reference cell coding, with the stable individuals as the reference category, the fitted regression model might be: $$\text{test performance}=\beta_0 + \beta_1\text{anxiety} + \beta_2\text{unstable} + \beta_3\text{anxiety}*\text{unstable}$$ In such a case, the slope of the first line would be $\beta_\text{anxiety}$ (since $\text{unstable}$ would equal 0), but the slope of the second line would be $\beta_1+\beta_3$. If someone asked you how much test taking performance would be impaired if anxiety went up by one unit, you would have to say, 'that depends, emotionally stable students would score $\beta_1$ points lower, but emotionally unstable individuals would drop by $\beta_1+\beta_3$ points'.

This is the essence of what an interaction is. In addition, these examples illustrate the necessity of interpreting simple effects only when interactions exist, and the value of using plots of your model to facilitate understanding.

With a generalized linear model, the situation is essentially the same, but you may have to take into account the additional complexity of the link function (a non-linear transformation), depending on which scale you want to use to make your interpretation. Consider the case of logistic regression, there are (at least) three scales available: The betas exist on the logit (log odds) scale, whereas $\pi$ (the probability of 'success') exists only in the interval $(0,1)$ and behaves quite differently; in addition, the odds lie between them. So you need to chose which of these you want to use to interpret your model. For example, with respect to the log odds, the model is linear, and everything can be understood just as above.

If you were using the odds, you can get odds ratios by exponentiating your betas. For example, if there is no interaction, the odds ratio associated with a one unit increase in $X_1$ is $\exp(\beta_1)$. This would also be the odds ratio of the reference category (like the emotionally stable students above) if there were an interaction with a dichotomous variable, but the contrasting category would be associated with an odds ratio of $\exp(\beta_1)*\exp(\beta_2)$.

Unfortunately, neither of those are very intuitively accessible for people, and the non-linear transformation (the link function) makes life more complicated. It is important to recognize that this isn't specific to interactions; the change in the probability of 'success' associated with increasing $X$ by one unit is never the same as (say) decreasing $X$ by one unit (except in the special case where $x_i$ is associated with $\pi=.5$). In other words, the change in probability associated with a one unit change in $X$ depends on where you are starting from (in this sense, you could perhaps metaphorically say that it interacts with itself). The best way to determine the change in probability associated with moving from one level of $X$ to another, is to plug in those levels, solve the regression equation for $\hat\pi$, and then subtract. The same thing is true if you have more than one variable, but no 'interaction' with the variable in question. This isn't anything special, it's just that 'where you are starting from' depends on the other variables as well. Again, the best way to determine the change in probability would be to solve for $\hat\pi$ at both places and subtract.

Interactions in a GLiM should also be treated similarly. It is best not to interpret interaction effects, but only simple effects (that is, the effect of $X_1$ on $Y$ holding $X_2$ constant). In addition, it's best to overlay plots of the predicted values (say, when $X_2=0$ vs. when $X_2=1$) on a scatterplot of your data. Now, for a logistic regression, it is often difficult to get a decent plot of your data as the points are all 0's and 1's, so you might just choose to leave them out. Nonetheless, a plot of the two curves will typically be the best thing to use. After you have the plot, a qualitative (verbal) description is often easy (e.g., 'probabilities don't start moving away from 0 until larger levels of $X_1$, and even then, raise more slowly').

Your situation is perhaps a little more complicated than this, because you have two continuous variables, rather than a continuous and a dichotomous one. However, this isn't a problem. Typically in this situation, people will be thinking primarily in terms of one of the predictor variables; then you can plot the relationship between that variable and $Y$ at several levels of the other predictor. If there are theoretically meaningful levels, you could use those, if not, you could use the mean and +/- 1 SD. If you didn't have a preference for one of the variables, you could flip a coin, or plot it both ways and see which will be easier to work with.

I don't know if / how SPSS will let you make those plots, but if you aren't able to find a way, they should be easy to make manually in Excel.

• Thanks so much for the lengthy answer but on the plots isn't a visual interpretation of the interaction difficult because the relationship is non-linear? Meaning, I was thinking the method for graphing that you are describing in the last paragraph only works well in a linear situation. – user20334 Feb 16 '13 at 19:03
• It can be hard to see the data in a plot, b/c they're only just 1's & 0's, but the sigmoid curve can be perfectly easy to see & informative. If your software can't do it, just get a column of X values in Excel, & plug those into your regression equation, then pass the output through an inverse logit transformation and make a line plot with the result & the original X. – gung - Reinstate Monica Feb 16 '13 at 19:19
• I see what you are getting at and I will give that a try. Thanks so much! – user20334 Feb 16 '13 at 20:58
• For an example of a plot of predicted probabilities when there is an interaction, it may help to see my answer here: Graphing a probability curve for a logit model with multiple predictors. – gung - Reinstate Monica Mar 8 '13 at 4:37
• Gung, I did something similar to what you suggested but I have some reservations. If you would be willing to give me some further help contact me on email. Thanks – user20334 Jul 13 '13 at 20:53