% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/model-validate.R
\name{tr_validate}
\alias{tr_validate}
\title{Validate a clinical prediction model}
\usage{
tr_validate(model, newdata = NULL, threshold = 0.5)
}
\arguments{
\item{model}{A fitted \code{triageR_model} object from \code{tr_fit()}.}

\item{newdata}{Optional data frame to validate on. If \code{NULL} (default),
validation runs on the original training data, with a warning.}

\item{threshold}{Numeric. Probability threshold for classifying the
positive class. Defaults to 0.5.}
}
\value{
A \code{triageR_validation} object (list) containing a metrics tibble
and the underlying predictions, invisibly printed as a summary.
}
\description{
Computes discrimination (AUC, sensitivity, specificity) and calibration
metrics for a fitted \code{triageR_model}. Can validate on new (external/holdout)
data, or fall back to the training data with a clear warning.
}
\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")
tr_validate(model, newdata = df)
}
