% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit-covariate.R
\name{prepare_dcvar_covariate_data}
\alias{prepare_dcvar_covariate_data}
\title{Prepare data for the covariate DC-VAR model}
\usage{
prepare_dcvar_covariate_data(
  data,
  vars,
  covariates,
  time_var = "time",
  standardize = TRUE,
  standardize_covariates = FALSE,
  allow_gaps = FALSE,
  prior_mu_sd = 2,
  prior_phi_sd = 0.5,
  prior_sigma_eps_rate = 1,
  prior_sigma_omega_rate = 0.1,
  prior_rho_init_sd = 1,
  prior_beta_sd = 1,
  zero_init_eta = TRUE
)
}
\arguments{
\item{data}{A data frame with time series observations.}

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

\item{covariates}{Character vector of covariate column names.}

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

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

\item{standardize_covariates}{Logical; whether to z-score covariates
(default: \code{FALSE}). Binary phase indicators should usually be left on
their original scale.}

\item{allow_gaps}{Logical; if \code{FALSE} (default), interior missing values
cause an error. If \code{TRUE}, they produce a warning and are removed.}

\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_sigma_omega_rate}{Prior mean for rho process SD:
\code{sigma_omega ~ exponential(1/prior_sigma_omega_rate)}. Default \code{0.1} gives
\code{exponential(10)} with prior mean 0.1.}

\item{prior_rho_init_sd}{Prior SD for initial rho on Fisher-z scale.}

\item{prior_beta_sd}{Prior SD for the covariate effects:
\code{beta ~ normal(0, prior_beta_sd)}.}

\item{zero_init_eta}{Logical; if \code{TRUE} (default), fixes the first residual
drift state at zero (\code{eta[1] = 0}). If \code{FALSE}, the first transition can
receive an immediate residual random-walk shock.}
}
\value{
A named list suitable as Stan data input.
}
\description{
Transforms a data frame into a list suitable for the Gaussian covariate
DC-VAR Stan models. Outcome rows are sorted by \code{time_var}; rows with missing
outcomes are removed with the same adjacency rules used by \code{\link[=prepare_dcvar_data]{prepare_dcvar_data()}},
and covariates are filtered in the same order so \code{X[t + 1, ]} aligns with the
outcome occasion of transition \code{Y[t, ] -> Y[t + 1, ]}.
}
