% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_generics.R
\name{ild_fit}
\alias{ild_fit}
\title{Fit a mixed model to ILD data (unified entry point)}
\usage{
ild_fit(
  formula,
  data,
  backend = c("lme4", "nlme", "brms"),
  correlation_class = c("auto", "AR1", "CAR1"),
  random = ~1 | .ild_id,
  warn_no_ar1 = TRUE,
  warn_uncentered = TRUE,
  prior = NULL,
  prior_template = c("default", "weakly_informative", "minimal_shrinkage"),
  ...
)
}
\arguments{
\item{formula}{Passed to [ild_lme()] or [ild_brms()].}

\item{data}{An ILD object (see [is_ild()]).}

\item{backend}{Character. \code{"lme4"} (default, [lme4::lmer()]), \code{"nlme"}
([nlme::lme()] with AR1/CAR1 residual structure), or \code{"brms"} ([brms::brm()]).}

\item{correlation_class, random, warn_no_ar1}{Passed to [ild_lme()] when
\code{backend} is \code{"lme4"} or \code{"nlme"}. Ignored when \code{backend = "brms"},
except \code{correlation_class} must be \code{"auto"} for \code{"brms"} (non-\code{"auto"}
values are for residual correlation under \code{nlme} only and will error).}

\item{warn_uncentered}{Passed to [ild_lme()] or [ild_brms()].}

\item{prior, prior_template}{Passed to [ild_brms()] when \code{backend = "brms"}.
For \code{"lme4"} / \code{"nlme"}, \code{prior} must be \code{NULL} and
\code{prior_template} must remain the default (\code{"default"}); otherwise an error
is raised so mistaken cross-backend arguments are not silently ignored.}

\item{...}{Passed to [ild_lme()] / [lme4::lmer()] / [nlme::lme()] or [ild_brms()].}
}
\value{
A fitted model: \code{lmerMod} / \code{lme} from [ild_lme()], or \code{brmsfit}
  from [ild_brms()], each with the same attributes as those functions document.
}
\description{
Façade that selects the estimation backend explicitly. Equivalent to calling
[ild_lme()] for \code{"lme4"} / \code{"nlme"}, or [ild_brms()] for \code{"brms"}.
Named functions remain the primary APIs for full documentation and examples.
}
\details{
**State-space / latent-dynamics models** are not mixed-model formulas:
use [ild_kfas()] or [ild_ctsem()] directly;
see \code{vignette("kfas-choosing-backend", package = "tidyILD")}.

To pass \code{backend} to \code{brms::brm()} (e.g. \code{"rstan"} vs \code{"cmdstanr"}), use
[ild_brms()] directly: \code{ild_fit()} reserves \code{backend} for the tidyILD engine
(\code{"lme4"}, \code{"nlme"}, \code{"brms"}).
}
\seealso{
[ild_kfas()] and [ild_ctsem()] for state-space / latent-dynamics
  backends (not available via \code{ild_fit()}).
}
