Say I have a model with one response variable ($y$, a continuous variable) and two predictor variables ($x_1$ & $x_2$, both continuous). My model includes both the additive effects of these variables and their interaction.

$$ y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \delta(x_1 \cdot x_2) +\epsilon $$

The interpretation of $\delta$ in this case (i.e. the interaction coefficient) is the change in slope of $\beta_2$ given a unit change in $x_1$ (correct me if I'm wrong).

However, the data I'm working with (and modelling for the purpose of prediction rather than inference) exhibit a more complex interaction than this. The slope of $\beta_2$ seems to change as a quadratic function of $x_1$. Is there any way to incorporate this into my linear model?

The dataset I'm working with is too large to paste here, and if I could easily reproduce the problem I probably wouldn't be asking the question. I expect there is a simple solution and lack of coffee is just getting the better of me...

  • $\begingroup$ Welcome to the site. Can you post some output from the model to help us understand what you're dealing with? $\endgroup$ Apr 28 '16 at 21:01
  • 1
    $\begingroup$ Why not include a term $x_3\equiv x_2^2$? $\endgroup$ Apr 28 '16 at 22:42

In principle you could try to model

$y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + (\beta_3 x_1 + \beta_4 x_1^2)x_2 + \varepsilon$

In practice I would model the main effects at least as flexible as the interaction effects, as otherwise any non-linearity in the effect of the main effect tends to have a lot of influence on the interaction effect. So I would try

$y = \beta_0 + \beta_1 x_1 + \beta_2 x_1^2 + \beta_3 x_2 + (\beta_4 x_1 + \beta_5 x_1^2)x_2 + \varepsilon$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.