% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_brms.R
\name{ild_brms}
\alias{ild_brms}
\title{Fit a Bayesian mixed model to ILD data with \pkg{brms}}
\usage{
ild_brms(
  formula,
  data,
  prior = NULL,
  prior_template = c("default", "weakly_informative", "minimal_shrinkage"),
  warn_uncentered = TRUE,
  ...
)
}
\arguments{
\item{formula}{A \pkg{brms} / \pkg{lme4}-style formula (e.g. \code{y ~ x + (1|id)}).}

\item{data}{An ILD object from [ild_prepare()].}

\item{prior}{Optional \code{brmsprior} object. If \code{NULL}, built from \code{prior_template}.}

\item{prior_template}{Passed to [ild_prior_ild()] when \code{prior} is \code{NULL}.}

\item{warn_uncentered}{If \code{TRUE} (default), warn when a numeric predictor varies
within and between persons without \code{_wp}/\code{_bp} (same idea as [ild_lme()]).}

\item{...}{Arguments passed to [brms::brm()] (e.g. \code{chains}, \code{iter},
\code{warmup}, \code{control}, \code{backend}, \code{seed}).}
}
\value{
A \code{brmsfit} object with attributes:
  \describe{
    \item{\code{ild_data}}{The ILD data frame.}
    \item{\code{ild_posterior}}{List: sampler settings, prior summary, divergences, etc.}
    \item{\code{ild_provenance}}{Standard tidyILD analysis provenance.}
  }
}
\description{
Wraps [brms::brm()] with ILD validation, default priors for common longitudinal
mixed models, standardized posterior metadata in \code{attr(fit, "ild_posterior")},
and analysis provenance (priors, chains, iterations). Attach \code{ild_data} for
use with [ild_tidy()], [ild_augment()], [ild_diagnose()], and [ild_methods()].
}
\details{
Requires packages \pkg{brms} and a Stan backend (\pkg{rstan} or \pkg{cmdstanr}).
}
\seealso{
[ild_fit()] with \code{backend = "brms"} is equivalent to \code{ild_brms()}.
  For IPW/MSM workflows, full Bayesian joint MSM is not in tidyILD; see [ild_msm_inference].
}
