Stepwise regression using p-values to drop variables with nonsignificant p-values

后端 未结 6 986
感动是毒
感动是毒 2020-11-29 16:46

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

6条回答
  •  -上瘾入骨i
    2020-11-29 17:30

    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
    

提交回复
热议问题