% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model-selection.R
\name{tl_step_selection}
\alias{tl_step_selection}
\title{Perform stepwise selection on a linear model}
\usage{
tl_step_selection(
  data,
  formula,
  direction = "backward",
  criterion = "AIC",
  trace = FALSE,
  steps = 1000,
  ...
)
}
\arguments{
\item{data}{A data frame containing the training data}

\item{formula}{A formula specifying the initial model}

\item{direction}{Direction of stepwise selection:
"forward", "backward", or "both"}

\item{criterion}{Criterion for selection: "AIC" or "BIC"}

\item{trace}{Logical; whether to print progress}

\item{steps}{Maximum number of steps to take}

\item{...}{Additional arguments to pass to step()}
}
\value{
A \code{tidylearn_model} object of class
\code{tidylearn_linear} wrapping the selected \code{\link[stats]{lm}}
model. Access the underlying model via \code{$fit} and the selected
formula via \code{$spec$formula}.
}
\description{
Perform stepwise selection on a linear model
}
\examples{
\donttest{
model <- tl_step_selection(mtcars, mpg ~ ., direction = "backward")
summary(model)
}
}
