'How to see if the addition of an interaction term affects the dependent variable?
I have a model of a few independent variables and one dependent one. I need to know how can I see if the addition of the interaction terms of two independent variable affect the dependent variable. I will also need to know how to put the interaction term in the model and how to decide if it actually affects it or not. Thanks
Solution 1:[1]
You should look on cross validated
They have answered many questions like this.
But quickly:
say you have 6 independent variables x1,x2,...,x6
You believe all 6 independent vars have an effect on y, the dependent variable. You are interested in the interaction between two dependent variables,say x1 and x2.
Run one model with and one without the interaction term. The model without the interaction:
lm1=lm(y~x1+x2+x3+x4+x5+x6)
Then run the model with the interaction term
lm2=m(y~x1+x2+x3+x4+x5+x6 + x1:x2)
test to see if the larger model is significantly better fitting.
anova(lm1,lm2)
That gives something like:
Model 1: y ~ x1 + x2 + x3 ...
Model 2: y ~ x1 + x2 + x3 + ... x1:x2
Res.Df RSS Df Sum of Sq F Pr(>F)
1 96 235.79
2 95 118.52 1 117.28 94.007 7.384e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
So the F is bigger than 2 we can reject the null that there is no effect of the interaction conditioned on the effects of x1, x2 and x3.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
