# How does step function selects best linear Models which includes polynomial effects and interaction effects in R?

I try to find "best" linear models with continuous and categorical covariables with Interaction Effect by BIC. The continuous covariables should have a quadratic effect on the response variable.

Additional to that, I want to extract the significant covariates from the full model by the following rule:

- If $Covariable_1*Covariable_i !=0$ for one of the i Covariates, then Covariates_1 and Covariates_i remain in the model (i.e also if just the first order term of the polynomial is significant wrt. p-value then we include also the quadratic term), also all significant interactions - If $Covariates_1*Covariates_i==0$ for all i then we exlude this Interaction Term and look at the maineffects of covariate_1: if there is no effect at all, then we remove this covariate.

Does this rule make any sense?

I wonder whether the step function in R considers this rule automatically and if not, whether there is any procedures/methods to this in R.

How would you start and find the best linear model with polynomial effect if you had to choose?

Does this rule make any sense?

It's sensible in empirical modelling to follow the Principle of Marginality: See Venables (1998), "Exegeses on linear models", S-Plus Users' Conference, Washington DC, Including the interaction but not the main effects in a model, Do all interaction terms need their individual terms in a regression model?, & Does triple interaction need to include all main effect variables?.

I wonder whether the step function in R considers this rule automatically and if not, whether there is any procedures/methods to this in R.

Don't know about step—check the manual or code.

How would you start and find the best linear model with polynomial effect if you had to choose?

If I had to use some automatic method for model selection (& I'd rather not—see Algorithms for automatic model selection, & Flom & Cassell (2007), "Stopping stepwise", NESUG), I'd use LASSO in almost all situations that come up in practice (see What are modern, easily used alternatives to stepwise regression?). Otherwise, I'd treat it as a matter of deciding how best to spend degrees of freedom in modelling curvilinear relationships: see the hand-outs for Frank Harrell's Regression Modeling Strategies course, §4.1.

• I love CV answers that reference other CV contributors.
– Sycorax
Jan 31, 2015 at 17:55
• @user777: Thanks! I hadn't thought, but that's two in one answer. Jan 31, 2015 at 18:02
• Thanks for the answer! As far as I can see, the step function automatically works according to my rule - so at least this question is solved. Feb 1, 2015 at 14:52
• You're welcome. I had a quick look, & step calls drop1 & add1 - the help pages for these say they do respect the Marginality Principal (though that'll depend on you using the formula interface I suppose). Feb 1, 2015 at 15:46