% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buzzEBMcontMcontY.R
\name{buzzEBMcontMcontY}
\alias{buzzEBMcontMcontY}
\title{Fit Bayesian Mediation Model (Continuous M & Continuous Y)}
\usage{
buzzEBMcontMcontY(
  model,
  dataset,
  my_prior = NULL,
  advanced = NULL,
  m.prec.shape = NULL,
  m.prec.rate = NULL,
  y.prec.shape = NULL,
  y.prec.rate = NULL,
  a.coef.mean = NULL,
  a.coef.prec = NULL,
  b.coef.mean = NULL,
  b.coef.prec = NULL,
  a.pip.hyperalpha = NULL,
  a.pip.hyperbeta = NULL,
  b.pip.hyperalpha = NULL,
  b.pip.hyperbeta = NULL,
  direct.coef.mean = NULL,
  direct.coef.precision = NULL,
  m.prec.init = NULL,
  y.prec.init = NULL,
  direct.coef.init = NULL,
  a.pip.hyperprior.init = NULL,
  b.pip.hyperprior.init = NULL,
  n_chains = NULL,
  n_adapt = NULL,
  n_burnin = NULL,
  n_iter = NULL,
  thin = NULL
)
}
\arguments{
\item{model}{A description of the model to be fitted. This is typically a
formula or a character string using \code{lavaan} syntax (e.g., \code{Y ~ M + X}).}

\item{dataset}{A \code{data.frame} containing the variables specified in the model.}

\item{my_prior}{Optional \code{data.frame} containing custom prior specifications.
Run \code{parms <- run_parms_wizard()} to see the required structure.}

\item{advanced}{Character. Use \code{"interactive"} for an interactive wizard
to choose parameter distributions, or leave \code{NULL} for defaults.}

\item{m.prec.shape, m.prec.rate}{Numeric scalar or vector of length equal to
the number of mediators. Shape and rate parameters of the Gamma hyperprior
for the mediator residual precisions. By default, a Gamma distribution is
used. The default values are 1 and 0.001, respectively.}

\item{y.prec.shape, y.prec.rate}{Numeric scalar. Shape and rate parameters
of the Gamma hyperprior for the outcome residual precision. By default, a
Gamma distribution is used. The default values are 1 and 0.001, respectively.}

\item{a.coef.mean, a.coef.prec}{Numeric scalar or vector.
Mean and precision parameters of the Normal prior for the \eqn{a} path effects.
By default, a Normal distribution is used. The default values are 0 and 1.0E-6,
respectively.}

\item{b.coef.mean, b.coef.prec}{Numeric scalar or vector.
Mean and precision parameters of the Normal prior for the \eqn{b} path effects.
By default, a Normal distribution is used. The default values are 0 and 1.0E-6,
respectively.}

\item{a.pip.hyperalpha, a.pip.hyperbeta}{Numeric scalar or vector. Alpha and
beta parameters for the Beta hyperprior of the \eqn{a} path inclusion
probabilities. By default, a Beta distribution is used. The default value is 3.}

\item{b.pip.hyperalpha, b.pip.hyperbeta}{Numeric scalar or vector. Alpha and
beta parameters for the Beta hyperprior of the \eqn{b} path inclusion
probabilities. By default, a Beta distribution is used. The default value is 3.}

\item{direct.coef.mean, direct.coef.precision}{Numeric scalar or vector.
Mean and precision parameters for the Normal prior of the direct effects
(\eqn{c'}). By default, a Normal distribution is used. The default values
are 0 and 1.0E-6, respectively.}

\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.}

\item{n_chains}{Integer. Number of MCMC chains.}

\item{n_adapt}{Integer. Number of adaptation iterations.}

\item{n_burnin}{Integer. Number of burn-in iterations.}

\item{n_iter}{Integer. Number of post-burn-in iterations.}

\item{thin}{Integer. Thinning interval.}
}
\value{
An object of class \code{mcmc.list} containing posterior samples.
}
\description{
This function implements variable selection for mediators in a fully
continuous framework. It automates data preparation, JAGS model
construction using Gaussian likelihoods, and MCMC sampling.
}
\details{
Fits a Bayesian mediation model specifically designed for cases where both
the mediators (\eqn{M}) and the outcome variable (\eqn{Y}) are continuous.


This function is a specific "worker" function. It identifies \eqn{X, M, Y}
via \code{.parse_buzz_syntax} and performs Bayesian estimation assuming:
\eqn{M \sim Normal(\dots)} and \eqn{Y \sim Normal(\dots)}.
}
\examples{
# 1. Create a continuous synthetic dataset
set.seed(123)
n <- 100
toy_data <- data.frame(
   X = rnorm(n),
   M1 = rnorm(n),
   M2 = rnorm(n),
   Y = rnorm(n)
)

# 2. Fit the model using lavaan-style syntax
# We define Y as the outcome, with M1, M2, and X as predictors
results <- buzzEBMcontMcontY(
   model    = "Y ~ M1 + M2 | X",
   dataset  = toy_data,
   n_burnin = 500,
   n_iter   = 2000
)

# 3. Check results
summary(results)

}
\references{
Shi, D., Shi, D., and Fairchild, A. J. (2023) "Variable Selection for Mediators
under a Bayesian Mediation Model" <doi:10.1080/10705511.2022.2164285>
}
