% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit.R
\name{htdv_fit}
\alias{htdv_fit}
\alias{htdv_tac}
\alias{htdv_wsc}
\alias{htdv_mpc}
\title{Hierarchical Bayesian Fit for Dependent Variables}
\usage{
htdv_fit(
  x,
  model = c("tac", "wsc", "mpc", "whittle", "composite"),
  chains = 4L,
  iter = 4000L,
  warmup = iter\%/\%2L,
  refresh = max(iter\%/\%10L, 1L),
  adapt_delta = 0.99,
  max_treedepth = 12L,
  seed = NULL,
  ...
)

htdv_tac(x, ...)

htdv_wsc(x, ...)

htdv_mpc(x, ...)
}
\arguments{
\item{x}{Numeric vector of observations.}

\item{model}{One of \code{"tac"}, \code{"wsc"}, \code{"mpc"},
\code{"whittle"}, \code{"composite"}.}

\item{chains}{Number of HMC chains.}

\item{iter}{Total iterations per chain (warmup plus sampling).}

\item{warmup}{Number of warmup iterations.}

\item{refresh}{Stan progress refresh rate (0 suppresses output).}

\item{adapt_delta}{HMC adaptation target acceptance.}

\item{max_treedepth}{Maximum NUTS treedepth.}

\item{seed}{Optional integer seed forwarded to \pkg{rstan}.}

\item{...}{Additional arguments forwarded to \code{rstan::sampling}.}
}
\value{
An object of class \code{htdv_fit}, a list with components
  \code{stanfit}, \code{model}, \code{data}, \code{n}, \code{call}.
}
\description{
Fits the hierarchical Bayesian model described in the companion paper via
Hamiltonian Monte Carlo (NUTS) using \pkg{rstan}. Nuisance parameters
\code{sigma_inf}, \code{gamma_mix}, and (for WSC) \code{b} carry priors and
are integrated over.
}
\examples{
\donttest{
x <- rnorm(50)
fit <- htdv_fit(x, model = "tac", chains = 2, iter = 500,
                refresh = 0, seed = 1)
class(fit)
}

}
\references{
Hoffman, M.D., & Gelman, A. (2014). The No-U-Turn Sampler. JMLR 15(1):
1593-1623.
Betancourt, M. (2016). Diagnosing Suboptimal Cotangent Disintegrations in
HMC. <doi:10.48550/arXiv.1604.00695>.
}
