BMGM (Bayesian Mixed Graphical Model) is an R package for Bayesian inference on mixed graphical models, allowing the estimation of conditional independencies between continuous, discrete, categorical, and zero-inflated count data. The package employs MCMC sampling and spike-and-slab priors for structure learning and can handle missing data during inference.

Installation

You can install the development version of BMGM from GitHub with:

# install.packages("devtools")
devtools::install_github("mauroflorez/BMGM")

Example

For a more detailed example, see: https://mauroflorez.github.io/BMGM/articles/Example_Analysis.html

Quick Start

library(BMGM)

set.seed(123)
X <- matrix(rnorm(200), ncol = 4)
type <- rep("c", 4)  # All continuous independent variables

fit <- bmgm(X, type, nburn = 500, nsample = 1000)
fit$adj_G

📖 Main Functions

  • bmgm(): Fit the Bayesian Mixed Graphical Model
  • sampler_bmgm(): Gibbs sampler for generating data from the model
  • find_lambda(): Optimize transformation parameter (Roy & Dunson, 2020)

📄 Reference

Florez, M., Gottard, A., McAdams, C., Guindani, M., & Vannucci, M. (2025). A Bayesian approach for inference on mixed graphical models. Bayesian Analysis, Advance Publication, 1–28. https://doi.org/10.1214/25-BA1557