I have a dataset of 162 observations with a 151 different variables and I would like to perform stepwise regression on it, but to also do 10 fold cross validation on it. I have used the package DAAG before in order to perform 10 fold cross validation with multiple linear regression and was able to use one of its formulas:-
CVlm(df = data, seed=1500, m = 10, form.lm = formula(RT..seconds.~.,), printit=TRUE)
I was wondering whether the package supported the same thing but with stepwise regression? I've had a look through it's pdf but was unable to find anything.
I know that I can perform stepwise regression using the MASS package by doing
step <- stepAIC(fit, direction="both")
but can't see how I can incorporate 10-fold CV into the equation.
Thanks
The SuperLearner
package supports v-fold cross validation of stepwise regression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With