-
Notifications
You must be signed in to change notification settings - Fork 23
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
Handle extremely significant variables #173
Labels
Comments
# load libraries
library(readxl)
library(olsrr)
#>
#> Attaching package: 'olsrr'
#> The following object is masked from 'package:datasets':
#>
#> rivers
# data
ccpp <- read_excel("J:/R/blog_research/data.xlsx")
# model
model <- lm(PE ~ AT + V + AP + RH, data = ccpp)
# variable selection
# forward selection
ols_step_forward_p(model, penter = 0.3)
#>
#> Selection Summary
#> -----------------------------------------------------------------------------
#> Variable Adj.
#> Step Entered R-Square R-Square C(p) AIC RMSE
#> -----------------------------------------------------------------------------
#> 1 AT 0.8989 0.8989 3988.7509 59518.4764 5.4251
#> 2 RH 0.9209 0.9209 1040.1331 57171.2040 4.7983
#> 3 V 0.9284 0.9284 46.0872 56229.2420 4.5674
#> 4 AP 0.9287 0.9287 5.0000 56188.2290 4.5571
#> -----------------------------------------------------------------------------
# both direction
ols_step_both_p(model, pent = 0.05, prem = 0.1)
#>
#> Stepwise Selection Summary
#> -----------------------------------------------------------------------------------------
#> Added/ Adj.
#> Step Variable Removed R-Square R-Square C(p) AIC RMSE
#> -----------------------------------------------------------------------------------------
#> 1 AT addition 0.899 0.899 3988.7510 59518.4764 5.4251
#> 2 RH addition 0.921 0.921 1040.1330 57171.2040 4.7983
#> 3 V addition 0.928 0.928 46.0870 56229.2420 4.5674
#> 4 AP addition 0.929 0.929 5.0000 56188.2290 4.5571
#> -----------------------------------------------------------------------------------------
# backward selection
ols_step_backward_p(model)
#> [1] "No variables have been removed from the model." Created on 2020-12-31 by the reprex package (v0.3.0) |
aravindhebbali
changed the title
Exit selection procedures gracefully
Handle extremely significant variables
Dec 31, 2020
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to Serhat Akay for sharing the below reprex and bringing this issue to our notice.
The text was updated successfully, but these errors were encountered: