I want to perform a stepwise linear Regression using p-values as a selection criterion, e.g.: at each step dropping variables that have the
As mentioned by Gavin Simpson the function fastbw
from rms
package can be used to select variables using the p-value. Bellow is an example using the example given by George Dontas. Use the option rule='p'
to select p-value criteria.
require(rms)
model1 <- ols(Ozone ~ Temp * Wind * Solar.R, data=airquality)
model2 <- fastbw(fit=model1, rule="p", sls=0.05)
model2