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

ols_step_best_subset unable to force more than one variable in selection process #210

Open
jorgevallejo opened this issue Mar 22, 2024 · 0 comments
Assignees
Labels

Comments

@jorgevallejo
Copy link

jorgevallejo commented Mar 22, 2024

Reading the documentation for function ols_step_best_subset, I understand that it is possible to force several variables in the selection process through the argument include. The argument would accept a character or numeric vector.

It works as expected when providing only one variable. But for vectors of more than one variable, only the first one is forced in the selection process.

A warning message is returned along with the results of the selection:

Warning message:
In grep(include, predicts) :
  argument 'pattern' has length > 1 and only the first element will be used

I am using version 0.6.0 of olsrr package, version 4.3.1 of R, RStudio 2022.07.0 Build 548 on Windows 10.

Reproducible example using dataset mtcars:

library(olsrr)

data(mtcars)

mtcars.lm <- lm(mpg ~ ., data = mtcars)

ols_step_best_subset(model = mtcars.lm,
                     include = c('cyl','disp'),
                     metric = 'aic')
@jorgevallejo jorgevallejo changed the title ols_step_best_subset unable to include more than one variable in selection process ols_step_best_subset unable to force more than one variable in selection process Mar 22, 2024
@aravindhebbali aravindhebbali self-assigned this Mar 23, 2024
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

2 participants