Learn R Programming

bgms (version 0.1.6.3)

bgms-package: bgms: Bayesian Analysis of Networks of Binary and/or Ordinal Variables

Description

The R package bgms provides tools for Bayesian analysis of the ordinal Markov random field (MRF), a graphical model describing networks of binary and/or ordinal variables MarsmanVandenBerghHaslbeck_2025bgms. The likelihood is approximated via a pseudolikelihood, and Markov chain Monte Carlo (MCMC) methods are used to sample from the corresponding pseudoposterior distribution of model parameters.

The main entry points are:

  • bgm: estimation in a one-sample design.

  • bgmCompare: estimation and group comparison in an independent-sample design.

Both functions support Bayesian effect selection with spike-and-slab priors.

  • In one-sample designs, bgm models the presence or absence of edges between variables. Posterior inclusion probabilities quantify the plausibility of each edge and can be converted into Bayes factors for conditional independence tests.

  • bgm can also model communities (clusters) of variables. The posterior distribution of the number of clusters provides evidence for or against clustering SekulovskiEtAl_2025bgms.

  • In independent-sample designs, bgmCompare estimates group differences in edge weights and category thresholds. Posterior inclusion probabilities quantify the evidence for differences and can be converted into Bayes factors for parameter equivalence tests MarsmanWaldorpSekulovskiHaslbeck_2024bgms.

Arguments

Tools

The package also provides:

  1. Simulation of response data from MRFs with a Gibbs sampler (simulate_mrf).

  2. Posterior estimation and edge selection in one-sample designs (bgm).

  3. Posterior estimation and group-difference selection in independent-sample designs (bgmCompare).

Vignettes

For tutorials and worked examples, see:

Author

Maintainer: Maarten Marsman m.marsman@uva.nl (ORCID)

Authors:

  • Don van den Bergh (ORCID)

Other contributors:

  • Nikola Sekulovski (ORCID) [contributor]

  • Giuseppe Arena (ORCID) [contributor]

  • Laura Groot [contributor]

  • Gali Geller [contributor]

References

See Also