# Help on interaction terms

Briefly, I am analysing how competitions and games run and what can affect performance in those competitions. Each individual plays in multiple competitions one after each other and receives an overall rating that signals how well they are doing based on how many competitions they have played in so far and won.

I want to analyse the effects of winning and losing streak but don't know how to model them with the following variables I have.

(1) Dummy variable = 1, if the individual is currently on a winning streak, and =0 if the individual is currently on a losing streak. (A streak can be made up of just one competition, so if I play for the first time and win, that is classed as I am on a "winning streak").

(2) Variable that tells you how long you're current streak has lasted. However, it doesn't distinguish between winning and losing streaks. So a value of "5" here could mean a winning streak of 5 or a losing streak of 5, essentially it is how long you're current streak has lasted.

I want to interact these terms to best analyse the impact on performance of such streaks, but I am having trouble interpreting the interaction term and especially the main effects term of (2) if it doesn't distinguish between good or bad streaks. I would like to ideally know how the length of a good streak affects performance and how the length of a bad streak affects performance.

Unfortunately, I cannot comment and ask for the model summary you received but I'll try to answer it fully regardless, and you let me know if I understood you correctly and whether it answers your question.

When you run a model with a dummy variable, your model assumes that always 1 of the groups of the categorical must be "true" and treats one of them as the reference group. Therefore the main effect of your continuous variable is not fully independent but gives you the coefficient given reference group.

When you treat categories as 0 and 1, what you call your main effect's coefficient is only true for group 0, the losing streak. The interaction that appears later gives you the coefficient given group 1 (winning)

You can find an elaboration of this here https://www.r-bloggers.com/interpreting-interaction-coefficient-in-r-part1-lm/

To really understand linear models and interaction terms it is best to go back to algebra and factoring (yes, that topic that many ask: "when will I ever use this?").

Your model will be something like:

$$y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \beta_3 x_1 x_2 + \epsilon$$

where $$x_1$$ and $$x_2$$ are your variables as described above and the $$\beta$$s are the model coefficients. Here are a couple of ways that we can factor the above equation (dropping $$\epsilon$$ for simplicity):

$$y = (\beta_0 + \beta_1 x_1) + (\beta_2 + \beta_3 x_1) x_2$$

$$y = (\beta_0 + \beta_2 x_2) + (\beta_1 + \beta_3 x_2) x_1$$

Looking at the top model we can think of it as an equation of $$x_2$$ that depends on $$x_1$$. The intercept is $$(\beta_0 + \beta_1 x_1)$$ and the slope (on $$x_2$$) is $$(\beta_2 + \beta_3 x_1)$$. So the intercept and slope for $$x_2$$ depend on the value of $$x_1$$. We can also see that $$\beta_2$$ is the "baseline" slope for $$x_2$$ when $$x_1$$ is 0 and $$\beta_3$$ is the adjustment to that slope when $$x_1$$ is not 0. The second factoring can be interpreted similarly.

You say that you are having a hard time interpreting the main effect term. That is because you should not be interpreting main effect terms when there are interactions. Remember one definition of the coefficient on $$x_2$$ is "the effect of a 1 unit increase in $$x_2$$ holding all other predictors constant", but with an interaction term you cannot change $$x_2$$ relative to $$\beta_2$$ wile holding $$x_2$$ constant relative to $$\beta_3$$ (and $$x_1$$). It is better to think of $$\beta_2$$ as the slope for $$x_2$$ when $$x_1 = 0$$ and $$\beta_2 + \beta_3$$ as the slope for $$x_2$$ when $$x_1 = 1$$.

With interactions, coefficients need to be interpreted in combination (with other coefficients and variables) not individually. As things become more complicated it may be easier to interpret predictions from the model rather that the individual coefficients.