% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data-preparation.R
\name{prepare_hmm_data}
\alias{prepare_hmm_data}
\title{Prepare data for the HMM copula model}
\usage{
prepare_hmm_data(
  data,
  vars,
  K = 2,
  time_var = "time",
  standardize = TRUE,
  margins = "normal",
  skew_direction = NULL,
  prior_mu_sd = 2,
  prior_phi_sd = 0.5,
  prior_sigma_eps_rate = 1,
  prior_kappa = 10,
  prior_alpha_off = 1,
  prior_z_rho_sd = 1,
  allow_gaps = FALSE
)
}
\arguments{
\item{data}{A data frame with time series observations.}

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

\item{K}{Number of hidden states (default: 2).}

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

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

\item{margins}{Character string specifying the marginal distribution.
One of \code{"normal"} (default), \code{"exponential"}, \code{"skew_normal"}, or \code{"gamma"}.}

\item{skew_direction}{Integer vector of length D indicating skew direction
for asymmetric margins. Each element must be \code{1} (right-skewed) or \code{-1}
(left-skewed). Required for \code{"exponential"} and \code{"gamma"} margins.}

\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:
\code{sigma_eps ~ exponential(1/prior_sigma_eps_rate)}. Default \code{1} gives
\code{exponential(1)} with prior mean 1.}

\item{prior_kappa}{Sticky Dirichlet self-transition concentration (default: 10).}

\item{prior_alpha_off}{Sticky Dirichlet off-diagonal concentration (default: 1).}

\item{prior_z_rho_sd}{Prior SD for state-specific z_rho values (default: 1.0).}

\item{allow_gaps}{Logical; if \code{FALSE} (default), interior missing values
cause an error. If \code{TRUE}, they produce a warning and are removed.}
}
\value{
A named list suitable as Stan data input.
}
\description{
Transforms a data frame into a list suitable for the HMM copula Stan model.
Includes HMM-specific prior hyperparameters.
}
