% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/define_init_values.R
\name{define_init_values}
\alias{define_init_values}
\title{Define Initial Values for Bayesian Mediation Model}
\usage{
define_init_values(
  P,
  K,
  M_cont,
  Y_cont,
  m.prec.init,
  y.prec.init,
  direct.coef.init,
  a.pip.hyperprior.init,
  b.pip.hyperprior.init
)
}
\arguments{
\item{P}{Integer. Number of predictors (\eqn{X}) in the model.}

\item{K}{Integer. Number of mediators (\eqn{M}) in the model.}

\item{M_cont}{Logical. If \code{TRUE}, initializes mediator precision
(\code{m.prec}). Set to \code{FALSE} for binary mediators.}

\item{Y_cont}{Logical. If \code{TRUE}, initializes outcome precision
(\code{y.prec}). Set to \code{FALSE} for binary outcomes.}

\item{m.prec.init, y.prec.init}{Numeric or \code{NULL}. Initial values for
residual precisions. Default is 1.}

\item{direct.coef.init}{Numeric or \code{NULL}. Initial value for the direct
effect (\eqn{c'}). Default is 0.}

\item{a.pip.hyperprior.init, b.pip.hyperprior.init}{Numeric or \code{NULL}.
Initial inclusion probabilities (PIP). Default is 0.5.}
}
\value{
A named \code{list} of initial values compatible with JAGS:
\describe{
  \item{\code{m.prec}}{Numeric vector of length \code{K} (if \code{M_cont = TRUE}).}
  \item{\code{a.coef}}{Numeric matrix of dimension \code{K x P}, initialized to 0.}
  \item{\code{a.pip}}{Binary vector of length \code{K}, initialized to 0.}
  \item{\code{b.coef}}{Numeric vector of length \code{K}, initialized to 0.}
  \item{\code{b.pip}}{Binary vector of length \code{K}, initialized to 0.}
  \item{\code{y.prec}}{Numeric scalar (if \code{Y_cont = TRUE}).}
  \item{\code{direct.coef}}{Numeric vector of length \code{P}, initialized to \code{direct.coef.init}.}
  \item{\code{a.pip.hyperprior}}{Numeric scalar.}
  \item{\code{b.pip.hyperprior}}{Numeric scalar.}
}
}
\description{
This internal function constructs the starting values for both the
parameters (coefficients and precisions) and the latent variables
(inclusion indicators). It handles the conditional inclusion of precision
parameters based on whether the mediators and outcome are continuous.
}
\details{
Generates a named list of initial values for MCMC chains, specifically
tailored for the Bayesian mediation model with variable selection.


The function uses the null-coalescing operator \code{\%||\%} to apply
system defaults when \code{NULL} values are passed from the main
wrapper functions.
}
\keyword{internal}
