bgms logo bgms logo
  • Overview
  • Get Started
  • Examples
  • Guide
  • Reference
  • Manual
  • News

bgms

Bayesian Graphical Models in R

  • Estimate networks of mixed binary, ordinal, and continuous variables
  • Use Bayesian variable selection to:
    • Quantify evidence for including or excluding edges
    • Detect group differences in network parameters
  • Discover communities of related edges with Bayesian edge clustering
  • Fast posterior inference with:
    • No-U-Turn sampler
    • Parallel multi-chain sampling
    • C++ backend

Explore structure in your network with principled Bayesian inference.

Get Started

User’s Guide

Worked Analyses

Quick Start

# Install from CRAN
install.packages("bgms")

# Fit an ordinal Markov random field to the Wenchuan earthquake data
library(bgms)
data(Wenchuan)
fit = bgm(Wenchuan)
summary(fit)

The same fit weighs every possible edge and reports the evidence:

Three network panels on one shared layout: evidence of presence (35 edges, weighted), evidence of absence (62, dashed), undecided (39, dotted).

The Wenchuan network split by evidence: pairs the data support, pairs they rule out, and pairs they leave undecided.

Of the 136 possible edges, 35 are supported, 62 are ruled out, and 39 are undecided: the split an estimated network cannot make. See the full analysis →

New to Bayesian graphical models? Start with the worked analyses. Coming from bootnet or qgraph? Start with your workflow, translated.

User’s Guide

Learn bgms from the ground up: installation, basic usage, and statistical concepts behind Bayesian graphical models for mixed variable types.

Guide →

Worked Analyses

Complete analyses, start to finish: fit a model, read the output, and see what each result licenses you to say.

Examples →

Reference

Complete documentation for all R functions: bgm(), bgmCompare(), S3 methods, and extractor functions.

Reference →

Manual

Technical documentation for contributors: C++ architecture, MCMC algorithms, and implementation details.

Manual →

Citation

If you use bgms in your research, please cite the software package.

Choose a citation format (version is set to the documented release):

Marsman, M., & van den Bergh, D. (2026). bgms: Bayesian analysis of graphical models (R package, version 0.2.0.0). https://CRAN.R-project.org/package=bgms

Marsman, Maarten, and Don van den Bergh. 2026. bgms: Bayesian Analysis of Graphical Models. R package, version 0.2.0.0. https://CRAN.R-project.org/package=bgms.


@Manual{bgms-package,
  title   = {bgms: Bayesian Analysis of Graphical Models},
  author  = {Marsman, Maarten and van den Bergh, Don},
  year    = {2026},
  note    = {R package version 0.2.0.0},
  url     = {https://CRAN.R-project.org/package=bgms}
}

TY  - COMP
TI  - bgms: Bayesian Analysis of Graphical Models
AU  - Marsman, Maarten
AU  - van den Bergh, Don
PY  - 2026
N1  - R package version 0.2.0.0
UR  - https://CRAN.R-project.org/package=bgms
ER  -

To generate citations directly from your installed package in R:

citation("bgms")
toBibtex(citation("bgms"))

The science

The tutorial developing this workflow end to end is in preparation. The methods are published: Marsman et al. (2022) on Bayesian edge screening and structure selection, Sekulovski et al. (2024) on testing conditional independence, and Huth et al. (2026) on how often published network edges rest on inconclusive evidence.

2026-08-04: bgms 0.2.0.0 is on CRAN. News →

Developed by the BGM Lab

  • FAQ

  • Built with Quarto

  • Edit this page
  • Report an issue