# Correct Way to Test Just the Interaction Term with Multiple Regression

Multiple regression will be performed on the following, to determine if the interaction term is significant:
1.The dependent variable A is continuous;
2.There are two independent variables, X and Y, which are Boolean.

I used lm() in R, isolating for just the interaction term.

lm(A ~ X:Y, data = SomeData)

Coefficients: (1 not defined because of singularities)
Estimate    Pr(>|t|)
(Intercept)         252.04    6.42e-06 ***
XTrue:YFalse        126.57    0.0623 .
XFalse:YFalse       156.61    0.0212 *
XTrue:YTrue          59.32    0.3594
XFalse:YTrue          NA         NA

F-statistic p-value: 0.08724


How do I interpret this, when testing whether the interaction between X and Y is significant, at the 0.05 confidence level? Is this the correct way to run this?

I avoided using lm(A ~ X*Y, data = SomeData) to isolate for X:Y. Is that necessary? I have read that using step-wise regression to remove terms can affect the p-values.

The Likelihood Ratio Test returns Pr(>Chisq) = .2804

a <- lm(A ~ X+Y, data=SomeData)
b <- lm(A ~ X*Y, data=SomeData)
lmtest::lrtest(a, b)


Running the full model returns an intercept + 3 term model, with a single interaction term, XFalse:YTrue, p = 0.317

lm(A~X*Y, data=SomeData)


Which one is correct? Can I do this just using multiple regression, without using the Likelihood Ratio Test? I am worried that running multiple tests affects the p-value - is that true?

• I think you can use likelihood ratio test. lmtest::lrtest() can test lm(A~X*Y) and lm(A~X+Y). – WCMC Aug 18 at 21:41
• Your intercept already captures the case of $X=0$ & $Y=0$, so it should not be included. In general, interaction terms between dichotomous variables aren't a good idea. – Durden Aug 18 at 21:43
• @Durden Why not? The interaction effect between smoking status and sex on disease is common in epi researchers. – WCMC Aug 18 at 21:44
• Sorry, I should've been more precise: I meant interaction terms of dichotomous variables in the way Larry implemented it. After all, he's just comparing different means. His regression model should be $A = \mu + \mathbf{1}(X=1) + \mathbf{1}(Y=1) + \mathbf{1}(X=1,Y=1)$, where $\mathbf{1}$ is the indicator function. – Durden Aug 18 at 21:49
• @Durden - I don't know how to leave out the intercept. If I add either + 0 or -1 to the call, all the significance values get crazy low. Those NA's also get replaced with real numbers. – user280191 Aug 18 at 21:51

Multiple websites say that the correct p-value for the significance of the interaction is given using the standard

lm(A ~ X*Y, data=SomeData)


which returns

                    Estimate  Pr(>|t|)
(Intercept)         376.79     4.7e-09 ***
XFalse               32.03     0.631
YTrue               -67.21     0.312
XFalse:YTrue        -90.38     0.317


So the p-value to use in the given hypothesis test is 0.317. (H: Is the interaction significant? Not at p < 0.05.)

If you think this is not correct, then please post the correct answer. Thanks.

• Please don't post a tentative answer & ask for comments / corrections. That isn't how SE sites work. If you want to do that, post your attempted solution as part of your question statement. – gung - Reinstate Monica Aug 19 at 11:33
• FWIW, this is correct. XFalse:YTrue is the test of the interaction. Your p-value is .317. Scientific culture requires the use of .05 as alpha; from a purely logical point of view, you can use whatever alpha you like, but setting $\alpha\ge.32$ would be pretty strange. The interaction isn't significant. – gung - Reinstate Monica Aug 19 at 11:35
• Thanks. (If you are referring to my answer, "Is the interaction significant" is quoting the hypothesis." I'm updating to clarify. ) – user280191 Aug 19 at 18:07