[R] GLMing with all possible combinations (automatically)

Christofer Bogaso bogaso.christofer at gmail.com
Wed Mar 7 12:16:51 CET 2012


Dear all, I was working with a GLM model and wondering whether is it
possible to have a model description with all possible main effects as
well as all interactions. Currently I do it manually however this will
become cumbersome if I have large number of variables.

Means suppose I have 3 explanatory variables and want to feed
automatically with all possible combinations like:


glm(Response~1)

glm(Response~X)
glm(Response~Y)
glm(Response~Z)

glm(Response~X+Y)
glm(Response~X+Z)
glm(Response~Z+Y)

glm(Response~X+Y+X*Y)
glm(Response~X+Z+X*Y)

.................................................... all combinations
which are possible

Thanks and regards,



More information about the R-help mailing list