Find important interactions automatically
Usage
tl_auto_interactions(
data,
formula,
top_n = 3,
min_r2_change = 0.01,
max_p_value = 0.05,
exclude_vars = NULL
)Arguments
- data
A data frame containing the data
- formula
A formula specifying the base model without interactions
- top_n
Number of top interactions to return, a whole number. With
0none is added.- min_r2_change
Minimum change in R-squared to consider
- max_p_value
Maximum p-value for significance
- exclude_vars
Character vector of predictor variables that may not appear in a selected interaction. They stay in the model as main effects. Every name must be a predictor in
formula.
Value
A tidylearn model object (class "tidylearn_model") fitted
with the top significant interaction terms added to the formula.
The interaction test results and selected interactions are stored as
attributes "interaction_tests" and
"selected_interactions", data frames in the layout
tl_test_interactions returns. Both are present when no
interaction is added, with no rows where there is nothing to report.
