For the same model, ols_step_backward_p() works or throws error for different range of prem (p value threshold for removing a variable from the model) values.
# load package
library(olsrr)
#>
#> Attaching package: 'olsrr'
#> The following object is masked from 'package:datasets':
#>
#> rivers
# model
model <- lm(y ~ age + gender + alc_mod, data = surgical)
# stepwise backward selection
# works
ols_step_backward_p(model, 0.2)
#>
#>
#> Elimination Summary
#> --------------------------------------------------------------------------
#> Variable Adj.
#> Step Removed R-Square R-Square C(p) AIC RMSE
#> --------------------------------------------------------------------------
#> 1 age 0.0653 0.0286 2.4695 802.9616 380.6259
#> --------------------------------------------------------------------------
# throws error
ols_step_backward_p(model, 0.1)
#> Error in str2lang(x): <text>:2:0: unexpected end of input
#> 1: y ~
#> ^
For the same model,
ols_step_backward_p()
works or throws error for different range ofprem
(p value threshold for removing a variable from the model) values.Created on 2021-08-13 by the reprex package (v0.3.0)