% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model-fit.R
\name{tr_fit}
\alias{tr_fit}
\title{Fit a clinical prediction model}
\usage{
tr_fit(
  data,
  outcome,
  engine = c("logistic_reg", "random_forest", "boost_tree"),
  predictors = NULL
)
}
\arguments{
\item{data}{A data frame containing predictors and the outcome column.}

\item{outcome}{Character. Name of the binary outcome column (must be a
factor or coercible to one, with the event of interest as the second level).}

\item{engine}{Character. Model engine to use. One of \code{"logistic_reg"},
\code{"random_forest"}, or \code{"boost_tree"}.}

\item{predictors}{Character vector of predictor column names. If \code{NULL}
(default), all columns except \code{outcome} are used.}
}
\value{
A fitted \code{triageR_model} object — a list containing the fitted
workflow, the engine used, and the outcome/predictor names.
}
\description{
Fits a binary classification model using the \code{parsnip}/\code{workflows}
framework. The user must specify the model engine explicitly.
}
\examples{
set.seed(1)
df <- data.frame(
  age = round(rnorm(50, 55, 12)),
  sex = sample(c("M", "F"), 50, replace = TRUE),
  disease = sample(c(0, 1), 50, replace = TRUE)
)
model <- tr_fit(df, outcome = "disease", engine = "logistic_reg")
}
