% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data-preparation.R
\name{prepare_multilevel_data}
\alias{prepare_multilevel_data}
\title{Prepare data for the multilevel copula VAR model}
\usage{
prepare_multilevel_data(
  data,
  vars,
  id_var = "id",
  time_var = "time",
  center = TRUE,
  prior_phi_bar_sd = 0.5,
  prior_tau_phi_scale = 0.2,
  prior_sigma_sd = 1,
  prior_rho_sd = 0.5,
  tv_phi = FALSE,
  tv_sigma = FALSE,
  prior_tau_phi_rate = 0.025,
  prior_tau_sigma_rate = 0.05,
  tv_sigma_k = 8,
  margins = "normal",
  skew_direction = NULL
)
}
\arguments{
\item{data}{A data frame in long (panel) format.}

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

\item{id_var}{Name of the unit/person ID column.}

\item{time_var}{Name of the time column.}

\item{center}{Logical scalar; person-mean center (default: \code{TRUE}).}

\item{prior_phi_bar_sd}{Prior SD for phi_bar.}

\item{prior_tau_phi_scale}{Prior scale for tau_phi.}

\item{prior_sigma_sd}{Prior SD for sigma.}

\item{prior_rho_sd}{Prior SD for rho.}

\item{tv_phi}{Selects which population VAR(1) coefficients carry a shared
time-varying drift. See \code{\link[=dcvar]{dcvar()}} for accepted selectors.}

\item{tv_sigma}{Logical; if \code{TRUE}, residual scales evolve over time.}

\item{prior_tau_phi_rate}{Prior mean for time-drift Phi random-walk SDs.}

\item{prior_tau_sigma_rate}{Prior mean for log-scale random-walk SDs.}

\item{tv_sigma_k}{Soft-barrier sharpness for time-varying exponential/gamma
scales.}

\item{margins}{Marginal distribution specification. A single string applies
the same family to both variables. Normal and exponential use specialised
Stan data contracts; skew-normal, gamma, and length-2 per-variable specs use
the generic \code{multilevel_mixed} Stan model with per-dimension family codes.}

\item{skew_direction}{Length-2 integer vector of +1/-1. Required whenever any
dimension uses an \code{"exponential"} or \code{"gamma"} margin.}
}
\value{
A named list suitable as Stan data input.
}
\description{
Prepare data for the multilevel copula VAR model
}
