The R
package bgms provides tools for
Bayesian analysis of graphical models describing networks of variables.
The package uses Markov chain Monte Carlo methods combined with a
pseudolikelihood approach to estimate the posterior distribution of
model parameters. Gibbs variable selection (George and McCulloch 1993)
is used to model the underlying network structure of the graphical
model. By imposing a discrete spike and slab prior on the pairwise
interactions, it is possible to shrink the interactions to exactly zero.
The Gibbs sampler embeds a Metropolis approach for mixtures of mutually
singular distributions (Gottardo and Raftery 2008) to account for the
discontinuity at zero. The goal is to provide these tools for Markov
Random Field (MRF) models for a wide range of variable types in the
bgms package, and it currently provides them for
analyzing networks of binary and/or ordinal variables (Marsman and
Haslbeck 2023).
Multivariate analysis using graphical models has received much attention in the recent psychological and psychometric literature (Robinaugh et al. 2020; Marsman and Rhemtulla 2022; Contreras et al. 2019). Most of these graphical models are Markov Random Field (MRF) models, whose graph structure reflects the conditional associations between variables (Kindermann and Snell 1980). In these models, a missing edge between two variables in the network implies that these variables are independent, given the remaining variables (Lauritzen 2004). In other words, the remaining variables of the network fully account for the potential association between the unconnected variables.
Testing the structure of the MRF requires us to determine the plausibility of the opposing hypotheses of conditional dependence and conditional independence. That is, how plausible is it that the observed data come from a network with a structure that includes the edge between two variables compared to a network structure that excludes that edge? Frequentist approaches are limited in this regard because they can only reject the conditional independence hypothesis, not support it (Wagenmakers et al. 2018; Wagenmakers 2007). This leads to the problem that if an edge is excluded, we do not know whether this is because the edge is absent in the population or because we lack the power to reject the null hypothesis of independence. To avoid this problem, we will use a Bayesian approach using Bayes factors (Kass and Raftery 1995)). The inclusion Bayes factor (Huth et al. 2023; Sekulovski et al. 2024) allows us to quantify how much the data support both conditional dependence -evidence of edge presence- or conditional independence -evidence of edge absence. It also allows us to conclude that there is limited support for either hypothesis (Dienes 2014)-an absence of evidence.
The current developmental version can be installed with
if (!requireNamespace("remotes")) {
install.packages("remotes")
} ::install_github("MaartenMarsman/bgms") remotes