With different limits for adding or deleting variables. It would the best if the anwser is with code or name of the package containing this function. Thanks!
In model-selection, is there a function in R that can do forward stepwise regression using p-values?
Asked
Active
Viewed 313 times
-3
-
try `step` ... but it uses AIC afaik. Maybe there is a parameter to set ... – Drey Nov 30 '16 at 13:41
-
2This is a very bad idea ... – Roland Nov 30 '16 at 13:43
-
See http://stats.stackexchange.com/questions/20836/algorithms-for-automatic-model-selection for some background as to why @Roland and I think this is such a mistake. – mdewey Nov 30 '16 at 15:29
-
@mdewey I know it is a bad idea but I am requested to do so. Sad. – AkiyamaYukari Nov 30 '16 at 16:48
1 Answers
0
Check the "add1()" (or "drop1()") and "update()" functions in the stats package. With the function add1() you get the p-value for the partial F-test for each variable which you can use to do the forward stepwise regression. Use update() to add the variable which is most significant. Then do add1() again. proceed with this procedure until there are no variables with a significant (previously defined threshold) p-value anymore.

Schlaftablette
- 114
- 3