How to automatically include all 2-way interactions in a glm model in R

后端 未结 1 995
心在旅途
心在旅途 2020-12-04 14:21

Suppose you are using R and have data stored in a data frame, M. Then I know that

g <- glm(Y ~ ., data=M) 

wi

相关标签:
1条回答
  • 2020-12-04 14:44

    You can do two-way interactions simply using .*. and arbitrary n-way interactions writing .^n. formula(g) will tell you the expanded version of the formula in each of these cases.

    0 讨论(0)
提交回复
热议问题