# Interaction terms

Suppose you have variables $X_{1}, \dots, X_{100}$ (can be discrete or continuous). If you want to test all possible interactions, should you include them all in 1 model? We are doing linear regression here.

-

## 2 Answers

No. That would be about $10^{30}$ interactions, which is probably too many variables for the data you have available.

-
So how would you choose which variables to test for interaction? – Thomy Ja Mar 7 '12 at 3:46
I would hope to have some theoretical basis for choosing a subset of variables to look at. If you want the data to dictate your choice you are in the world of data mining (I've added the data-mining tag) and should look up some of the methods there. – Peter Ellis Mar 7 '12 at 3:49
Where do you get $10^{30}$? Aren't there only $\binom{100}{2} = 4950$ possible pairwise interactions? – Macro Mar 7 '12 at 3:52
The question was all possible interactions: x <- 0; for (i in 2:100){x <- x + choose(100,i)}; x – Peter Ellis Mar 7 '12 at 4:01
First, resolve whether you mean all possible interactions (which is how @PeterEllis interpreted your question) or just all possible two-way interactions (which is how @macro) interpreted it. But I'd be cautious about a model with 100 variables, much less interactions among them. It's hard to conceive how such a model could be interpreted. What's the context? – Peter Flom Mar 7 '12 at 12:16
show 4 more comments

Quoting the wise Andrew Gelman (see p. 36) on hunting interactions:

In practice, inputs that have large main effects also tend to have large interactions with other inputs (however, small main effects do not preclude the possibility of large interactions). For example, smoking has a huge effect on cancer. In epidemiologial studies of other carcinogens, it is crucial to adjust for smoking both as a main effect and as an interaction[...]: high levels of radon are associated with greater likelihood of cancer but this difference is much greater for smokers than for nonsmokers.

-