Exploratory Bayesian Mediation Analysis with Variable Selection
A collection of quantitative tools for selecting mediating effects within exploratory Bayesian mediation models. The package accommodates both continuous and dichotomous outcomes, including the dependent variables and the mediators for identifying and analyzing mediation pathways.
- Multiple predictors and mediators
- Continuous or binary (0/1) mediators
- Continuous or binary (0/1) outcomes
- Automated model dispatch via formula syntax
This package requires JAGS (Just Another Gibbs Sampler) to be installed on your system. Download from: https://mcmc-jags.sourceforge.io/
You can install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("olfactorybulb/buzzMed")
library(buzzMed)The package provides a primary automated interface and four specialized model-fitting functions based on variable types:
buzzEBMcontMcontY(): Continuous mediators, continuous outcome.buzzEBMcontMcatY(): Continuous mediators, binary outcome.buzzEBMcatMcontY(): Binary mediators, continuous outcome.buzzEBMcatMcatY(): Binary mediators, binary outcome.
library(buzzMed)
# Create some toy data to play with
my_data <- data.frame(
MyPredictor = rnorm(30),
MyMediator1 = rnorm(30),
MyMediator2 = rnorm(30),
MyOutcome = rnorm(30)
)
# Specify your mediation model using syntax 'Y ~ M1 + M2 | X'
model_string <- "MyOutcome ~ MyMediator1 + MyMediator2 | MyPredictor"
# Run the model with continuous mediator and continuous outcome
fit <- buzzEBMcontMcontY(model = model_string, dataset = my_data)If you use buzzMed in your research, please cite:
Shi, D., Dexin Shi, & Amanda J. Fairchild (2023). Variable Selection for Mediators under a Bayesian Mediation Model. Structural Equation Modeling: A Multidisciplinary Journal, 30(6), 887-900. DOI: 10.1080/10705511.2022.2164285
This project is licensed under the GNU General Public License v3.0.
See the LICENSE file for details.