Hello all, I am trying to do factorial regression using lm() like this (example):
model<-lm(y ~ x1 + x2 + x3 + x4 + x1*x2*x3*x4) The final term 'x1*x2*x3*x4' adds all possible interactions between explanatory variables to the model. i.e. x1:x2, x1:x2:x3, etc, etc. Now, the issue is that some of the interactions are significant and some are not. I can manually remove features/interactions using 'update' like this: model1<-update(model,~. - x1:x2:x4) .... one by one as long as all the explanatory variables/features or interactions are significant. But, this is so tedious. There must be a way to say to R automatically 'I want to retain only significant features/interactions' OR to do something to update(remove) all non-significant interactions. model2<-step(model) ..was not very helpful. Are there any options to it? Can someone shed light on how I can do that? Can glm() or gam() or anything else be more powerful to do this? Any help is greatly appreciated! Many thanks, Parthiban. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.