1

I know that the stepAIC function in R allows us to perform stepwise regression but I was wondering if there's any option (or other function) to perform a F-statistic based stepwise regression ?

I've looked in the help of the stepAIC function but didn't find any answer.

Thanks a lot

A. Bohyn
  • 21
  • 5
  • Questions that are only about software (e.g. error messages, code or packages, etc.) are generally off topic here. If you have a substantive machine learning or statistical question, please edit to clarify. – gung - Reinstate Monica Jan 15 '18 at 16:09
  • Ok thanks I'll keep that in mind for my next questions. – A. Bohyn Jan 15 '18 at 16:12
  • 2
    Stepwise selection based on F-tests isn't going to be any better than stepwise selection based on the AIC or any other metric. To a first approximation, all stepwise selection is bad (cf, [Algorithms for automatic model selection](https://stats.stackexchange.com/a/20856/7290)). – gung - Reinstate Monica Jan 15 '18 at 16:13

1 Answers1

1

So I've found the answer I was looking for. The dropterm function for the MASS package allows us to perform backwards variable selection using any statistic we want. The equivalent function addterm allows to do the same with forward regression.

To do so, you simply need to add the argument test=c("none","Chisq","F") for the statistic you want. Keep in mind that the F-statistic selection only works for model of the class lm and aov.

A. Bohyn
  • 21
  • 5