1
$\begingroup$

I run a regression with a continuous variable $x_2$ and a binary grouping variable $x_1$. We suppose that the effect of $x_2$ is quadratic on the dependent variable $y$ and our question is whether the effect of $x_2$ on $y$ depends on $x_1$.

The formula is $y\sim x_{1} + x_{2} + x_{2}^{2} + x_{1} : x_{2} + x_{1} : x_{2}^{2}$. So I get two signifince tests for interaction, i.e. $p$ for $x_{1} : x_{2}$ and $p$ for $x_{1} : x_{2}^{2}$. What of the following statements is true:

  • We can say that there is a significant interaction if one of the both interaction coefficiens is significant, no matter whether it is a significant $p$ for $x_{1} : x_{2}$ or a significant $p$ for $x_{1} : x_{2}^{2}$
  • We can say that there is a significant interaction if both interactions coefficients are significant
  • We must first run a model without any interaction, then a model with both interaction terms, than compare both models using ANOVA. If the $p$ of the F test is significant we can say that there is a significant interaction.

Or is there another approach one must choose in order to test whether the effect of $x_2$ depends on $x_1$ significantly?


Edit

To make clearer point three:

model1 <- $y\sim x_{1} + x_{2} + x_{2}^{2}$

model2 <- $y\sim x_{1} + x_{2} + x_{2}^{2} + x_{1} : x_{2} + x_{1} : x_{2}^{2}$

ANOVA(model1, model2)

The p value of F in this ANOVA will show whether the effect of x2 depends on x1, i.e. whether the interaction is significant.

$\endgroup$

2 Answers 2

2
$\begingroup$

Don't think of indidivual coefficients when a variable is represented by more than one term in the model. Think of composite (AKA "chunk") tests which test more general hypotheses. Chunk tests use likelihood ratio, Wald, score, or $F$-tests and have multiple degrees of freedom. From the model specified above here are some useful chunk tests:

  • test all coefficients jointly that relate simultaneously to $x_{1}, x_{2}$ (2 d.f., tests whether effect of $x_2$ depends on $x_1$
  • test all coefficients relating to $x_1$ (3 d.f., tests whether $x_1$ is associated with $Y$ for any value of $x_2$)
  • test all coefficients relating to $x_2$ (4 d.f., tests whether $x_2$ is associated with $Y$ for any value of $x_1$)

All these chunk tests are provided automatically in the R rms package's anova function:

require(rms)
f <- ols(y ~ x1 * pol(x2, 2))
anova(f)  # provides F stats since using a linear (ordinary least squares) model

Chunk tests have interpretability and importantly do not depend on the coding/centering of variables. They also provide perfect multiplicity adjustment in frequentist modeling.

$\endgroup$
3
  • $\begingroup$ Does this correspond to point three in my question? Also see edit of my question. $\endgroup$
    – LulY
    Commented Aug 13, 2023 at 14:53
  • $\begingroup$ Shouldn't "test all coefficients relating to x2" be df 4? x2 has four coefficiens $\endgroup$
    – LulY
    Commented Aug 13, 2023 at 14:59
  • $\begingroup$ Thanks for the correction; fixed. Yes point 3. $\endgroup$ Commented Aug 13, 2023 at 15:35
1
$\begingroup$

The first one seems right to me.

The second one seems wrong.

The third one answers a somewhat different question: Do the interactions add a significant amount to the model?

However, I think it would be better to be more specific in the question and answer, by specifying the two different interactions.

$\endgroup$
1
  • $\begingroup$ You can state the 3rd either way, i.e., it tests whether the effect of one variable varies with the level of the other variable. I wouldn't stress "two different interactions". $x_2$ is expressed as 2 terms in the model and these terms need to be kept together, otherwise the tests are very coding/origin-dependent. $\endgroup$ Commented Aug 13, 2023 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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