Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in stepwise backward selection #186

Open
aravindhebbali opened this issue Aug 13, 2021 · 0 comments
Open

Error in stepwise backward selection #186

aravindhebbali opened this issue Aug 13, 2021 · 0 comments
Assignees
Labels

Comments

@aravindhebbali
Copy link
Member

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 ~ 
#>    ^

Created on 2021-08-13 by the reprex package (v0.3.0)

@aravindhebbali aravindhebbali self-assigned this Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant