# NOT RUN {
library(recipes)
glm_filter <- function(x, y, step) {
model_fit <- glm(y ~ ., data = data.frame(y, x))
p_value <- drop1(model_fit, test = "F")[-1, "Pr(>F)"]
p_value < step$threshold
}
rec <- recipe(rating ~ ., data = attitude)
sbf_rec <- rec %>%
step_sbf(all_numeric(), -all_outcomes(),
filter = glm_filter, options = list(threshold = 0.05))
sbf_prep <- prep(sbf_rec, training = attitude)
sbf_data <- bake(sbf_prep, attitude)
pairs(sbf_data, lower.panel = NULL)
tidy(sbf_rec, number = 1)
tidy(sbf_prep, number = 1)
# }
Run the code above in your browser using DataLab