% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit_bayesian.R
\name{fit_bayesian}
\alias{fit_bayesian}
\title{Fit the exact partition-likelihood model to forced Q sorts}
\usage{
fit_bayesian(
  Y,
  K,
  iterations = 12000,
  burn = 2000,
  thin = 5,
  max_iterations = 48000,
  seed = NULL,
  sigma_scale = 1,
  rhat_max = 1.01,
  ess_min = 400,
  prob = 0.95,
  keep_raw = TRUE,
  pivot = NULL,
  quiet = FALSE,
  ...
)
}
\arguments{
\item{Y}{A \code{qsort_data} object, or a \verb{J x N} numeric matrix of grid
positions with statements as rows and participants as columns. Every
sort must obey the forced distribution exactly.}

\item{K}{Integer number of factors.}

\item{iterations}{First-check chain length (default 12000, the settings
frozen in the accompanying paper).}

\item{burn}{Burn-in iterations (default 2000), paid once; extensions
continue the chain.}

\item{thin}{Keep every \code{thin}-th post-burn draw (default 5).}

\item{max_iterations}{Total-iteration cap for the gated extension ladder
(default 48000).}

\item{seed}{Optional integer seed; fits are exactly reproducible given
the seed.}

\item{sigma_scale}{Half-normal prior scale for the per-factor loading
scales (default 1).}

\item{rhat_max, ess_min}{Gate thresholds (defaults 1.01 and 400).}

\item{prob}{Credible-interval probability stored on the fit
(default 0.95).}

\item{keep_raw}{Keep the pre-alignment draws on the fit (default
\code{TRUE}); required by \code{\link[=extend]{extend()}} and by realignment under a different
pivot.}

\item{pivot}{Optional draw index for the alignment pivot; \code{NULL} (the
default) uses the median-condition-number rule.}

\item{quiet}{Suppress progress messages (default \code{FALSE}).}

\item{...}{Unused; supplying a removed 0.1.0 argument gives a migration
error.}
}
\value{
A \code{bayesqm_fit} carrying aligned draws, the gate report, the
alignment record, and (when \code{keep_raw = TRUE}) the raw draws and
sampler state.
}
\description{
Models each completed sort as a forced ordered partition of the
statements and samples the posterior of the latent factor model by a
parameter-expanded Gibbs sampler. Convergence is gated on
rotation-invariant person spreads (rank-normalized split-R-hat and
bulk/tail effective sample size); a chain failing the gate is
warm-extended at successive doublings up to \code{max_iterations}. Draws are
aligned by MatchAlign with a polarity canon, so defining sorts load
positively.
}
\examples{
fit <- demo_fit()
fit

}
