Learn R Programming

tidylearn (version 0.1.0)

tl_step_selection: Perform stepwise selection on a linear model

Description

Perform stepwise selection on a linear model

Usage

tl_step_selection(
  data,
  formula,
  direction = "backward",
  criterion = "AIC",
  trace = FALSE,
  steps = 1000,
  ...
)

Value

A selected model

Arguments

data

A data frame containing the training data

formula

A formula specifying the initial model

direction

Direction of stepwise selection: "forward", "backward", or "both"

criterion

Criterion for selection: "AIC" or "BIC"

trace

Logical; whether to print progress

steps

Maximum number of steps to take

...

Additional arguments to pass to step()