% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run_ebmed_jags.R
\name{run_ebmed_jags}
\alias{run_ebmed_jags}
\title{Execute JAGS MCMC Sampling for Exploratory Bayesian Mediation Models}
\usage{
run_ebmed_jags(
  modelstring,
  bdata,
  init,
  M_cont,
  Y_cont,
  n_chains,
  n_adapt,
  n_burnin,
  n_iter,
  thin
)
}
\arguments{
\item{modelstring}{Character string containing the generated JAGS model code.}

\item{bdata}{Named list of data (N, X, y, m1, m2...) for JAGS.}

\item{init}{Named list of starting values for the parameters.}

\item{Y_cont, M_cont}{Logical flags indicating the nature of the variables.
These determine whether residual precisions (\code{y.prec}, \code{m.prec})
are monitored.}

\item{n_chains, n_adapt, n_burnin, n_iter, thin}{Integer. MCMC tuning
parameters. If \code{NULL}, system defaults are applied (1, 1000, 1000,
10000, and 1, respectively).}
}
\value{
A \code{coda::mcmc.list} object containing the posterior samples
for the monitored parameters.
}
\description{
A worker function that handles the technical execution of the MCMC chains.
It dynamically determines which parameters to monitor based on the
distributional assumptions (continuous vs. binary) of the mediators
and outcome.
}
\details{
This internal function interfaces with the \code{rjags} package to initialize
the model, perform burn-in, and collect posterior samples.


The function follows the standard JAGS workflow:
\enumerate{
  \item \strong{Initialization:} Calls \code{\link[rjags]{jags.model}} with
  adaptation.
  \item \strong{Burn-in:} Discards initial samples using \code{\link[stats]{update}}.
  \item \strong{Sampling:} Collects final posteriors via \code{\link[rjags]{coda.samples}}.
}

Parameters monitored by default include coefficients (\code{a}, \code{b},
\code{direct.coef}), inclusion probabilities (\code{pip}), and joint
inclusion indicators (\code{ind.joint}).
}
\keyword{internal}
