% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit-constant.R
\name{dcvar_constant}
\alias{dcvar_constant}
\title{Fit the constant copula model}
\usage{
dcvar_constant(
  data,
  vars,
  time_var = "time",
  standardize = TRUE,
  margins = "normal",
  copula = "gaussian",
  skew_direction = NULL,
  allow_gaps = FALSE,
  prior_mu_sd = 2,
  prior_phi_sd = 0.5,
  prior_sigma_eps_rate = 1,
  prior_z_rho_sd = 1,
  chains = 4,
  iter_warmup = 2000,
  iter_sampling = 4000,
  adapt_delta = 0.999,
  max_treedepth = 12,
  seed = NULL,
  cores = NULL,
  refresh = 500,
  init = NULL,
  stan_file = NULL,
  backend = getOption("dcvar.backend", "auto"),
  ...
)
}
\arguments{
\item{data}{A data frame with time series observations.}

\item{vars}{Character vector of two variable names to model.}

\item{time_var}{Name of the time column (default: \code{"time"}).}

\item{standardize}{Logical; whether to z-score variables (default: \code{TRUE}).}

\item{margins}{Marginal distribution specification. Either a single string
applied to both variables, or a length-2 character vector giving a
per-variable (mixed) margin (for example
\code{c("normal", "exponential")}). Each entry is one of \code{"normal"} (default),
\code{"exponential"}, \code{"skew_normal"}, or \code{"gamma"}. When the two entries
differ the fit uses a generic mixed-margins Stan model; identical entries
are equivalent to the scalar form and reuse the specialised single-family
model. Mixed margins are supported with the Gaussian copula, and (for
\code{dcvar_constant}) additionally with the Clayton copula.}

\item{copula}{Character string specifying the copula family. One of
\code{"gaussian"} (default) or \code{"clayton"}. Clayton is currently available with
normal margins or a per-variable (mixed) margin vector; a single
non-normal family with Clayton is not yet supported.}

\item{skew_direction}{Integer vector of length 2 indicating skew direction
for asymmetric margins. Each element must be \code{1} (right-skewed) or \code{-1}
(left-skewed). Required whenever any dimension uses an \code{"exponential"} or
\code{"gamma"} margin; only those dimensions consult it.}

\item{allow_gaps}{Logical; if \code{FALSE} (default), interior missing values
cause an error because they break VAR(1) time series adjacency. Set to
\code{TRUE} to allow fitting with a warning instead.}

\item{prior_mu_sd}{Prior SD for intercepts: \code{mu ~ normal(0, prior_mu_sd)}.}

\item{prior_phi_sd}{Prior SD for VAR coefficients: \code{Phi ~ normal(0, prior_phi_sd)}.}

\item{prior_sigma_eps_rate}{Prior mean for innovation SDs (see
\code{\link[=prepare_dcvar_data]{prepare_dcvar_data()}}).}

\item{prior_z_rho_sd}{Prior SD for rho on Fisher-z scale (default: 1.0).}

\item{chains}{Number of MCMC chains (default: 4).}

\item{iter_warmup}{Warmup iterations per chain (default: 2000).}

\item{iter_sampling}{Sampling iterations per chain (default: 4000).}

\item{adapt_delta}{Target acceptance rate (default: 0.999). The constant
model uses a higher default than DC-VAR (0.99) because its simpler
posterior geometry benefits from tighter step-size adaptation without
significant cost, reducing occasional divergences near the rho boundary.}

\item{max_treedepth}{Maximum tree depth (default: 12).}

\item{seed}{Random seed. When supplied, it seeds both the Stan sampler and
the default per-chain initial values, so repeated fits are reproducible.}

\item{cores}{Number of parallel chains. \code{NULL} uses all available cores.}

\item{refresh}{How often to print progress (default: 500). Set to 0 for
silent operation.}

\item{init}{Custom init function or \code{NULL} for smart defaults.}

\item{stan_file}{Path to a custom Stan file, or \code{NULL} to use the bundled
model.}

\item{backend}{Character: \code{"auto"} (default, uses rstan), \code{"rstan"}, or
\code{"cmdstanr"}. Can also be set globally via
\code{options(dcvar.backend = "cmdstanr")}.}

\item{...}{Additional backend-specific sampling arguments.}
}
\value{
A \code{dcvar_constant_fit} object.
}
\description{
Fits a copula VAR(1) model with a single time-invariant correlation
parameter. This serves as a baseline for comparison with the DC-VAR
and HMM copula models.
}
\details{
\code{adapt_delta} defaults to 0.999 because the constant-rho model has
a simpler correlation structure that benefits from tighter step-size
adaptation without significant computational cost, reducing occasional
divergences near the rho boundary.
}
\examples{
\donttest{
sim <- simulate_dcvar(
  n_time = 12,
  rho_trajectory = rho_constant(12, rho = 0.5),
  seed = 1
)
fit <- dcvar_constant(
  sim$Y_df,
  vars = c("y1", "y2"),
  chains = 1,
  iter_warmup = 10,
  iter_sampling = 10,
  refresh = 0,
  seed = 1
)
print(fit)
}
}
\seealso{
\code{\link[=dcvar]{dcvar()}} for the time-varying model, \code{\link[=dcvar_hmm]{dcvar_hmm()}} for the
regime-switching model, \code{\link[=dcvar_compare]{dcvar_compare()}} for LOO-CV model comparison.
}
