Source-linked AI summary
BDgraph: An R Package for Bayesian Structure Learning in Graphical Models
Reza Mohammadi, Ernst C. Wit
TL;DR
Efficient discovery of graph structures from multivariate data is an active methodological area. BDgraph packages Bayesian structure learning for varied undirected graphical models in R, and implements recent improvements in computation, sampling, and inference. Its stated scope includes Gaussian, non-Gaussian, discrete, and mixed data; robust handling of outliers remains a proposed extension.
Problem
The paper addresses efficient discovery of graph structures from multivariate data, an area with significant recent algorithmic progress.
Source: §1 · p. 1Method
BDgraph is an R package for Bayesian structure learning in decomposable and non-decomposable undirected graphical models, with methods for Gaussian and other data types.
Source: §1 · p. 2, §7 · p. 22Results
BDgraph implements recent improvements in computation, sampling, and inference for Gaussian and Gaussian-copula graphical models across Gaussian, non-Gaussian, discrete, and mixed data.
Source: §7 · p. 22Takeaways & Limitations
The package provides tools for simulation, graph estimation, convergence assessment, and visualization within its supported graphical-model scope.
Source: §1 · p. 2, §4 · p. 11The conclusion identifies outlier handling as a possible extension, proposing robust Bayesian graphical modeling with Dirichlet t-distributions as desirable for actual applications.
Source: §7 · p. 23
Abstract
from arXiv · showhide
Graphical models provide powerful tools to uncover complicated patterns in multivariate data and are commonly used in Bayesian statistics and machine learning. In this paper, we introduce the R package BDgraph which performs Bayesian structure learning for general undirected graphical models (decomposable and non-decomposable) with continuous, discrete, and mixed variables. The package efficiently implements recent improvements in the Bayesian literature, including that of Mohammadi and Wit (2015) and Dobra and Mohammadi (2018). To speed up computations, the computationally intensive tasks have been implemented in C++ and interfaced with R, and the package has parallel computing capabilities. In addition, the package contains several functions for simulation and visualization, as well as several multivariate datasets taken from the literature and used to describe the package capabilities. The paper includes a brief overview of the statistical methods which have been implemented in the package. The main part of the paper explains how to use the package. Furthermore, we illustrate the package's functionality in both real and artificial examples.
1. Introduction
The introduction presents BDgraph as an R package for Bayesian structure learning in undirected graphical models, supporting varied data types and a broad analysis workflow. It places the package in the context of algorithmic progress in graph discovery and surveys the paper’s contents.
1. Introduction
- Graphical models represent conditional independence relationships among variables, with nodes for variables and links for conditional dependencies.An absent link implies conditional independence given the remaining variables.Source: §1 · p. 1
- Recent work has advanced efficient graph-structure discovery from multivariate data, and Bayesian approaches are presented as a principled alternative to penalized approaches.Source: §1 · pp. 1–2
- BDgraph supports Bayesian structure learning for Gaussian, non-Gaussian, discrete, and mixed data, with C++ linked to R to make computation feasible for moderately high-dimensional data.Its modules include simulation, search algorithms, graph estimation, convergence checks, and visualization.Source: §1 · p. 2
- BDgraph is among the few online Bayesian R packages for Gaussian and Gaussian copula graphical models, while more packages are available in the frequentist literature.Source: §1 · p. 2
- The paper outlines the package interface, methodological background, main functions, a simulation example, and applications to two real datasets.Source: §1 · p. 2
2. User interface
The user interface organizes BDgraph around data simulation, statistical methods, search algorithms, and functions for checking, comparing, and visualizing results. It also provides package installation and computational support through R-linked C++ code.
2. User interface
- Users install and load BDgraph in R; it loads igraph for visualization, while computationally intensive tasks use parallel C++ linked to R.OpenMP supports parallel computation, and optimized LAPACK and BLAS libraries improve program speed on systems that provide them.Source: §2 · p. 3
- BDgraph organizes its workflow around simulation, statistical methods, search algorithms, and functions for convergence checks, graph estimation, comparison, and visualization.Figure 1 depicts the package configuration; the package description calls the workflow three functional modules.Source: §2 · p. 3, Figure 1 · p. 3
- The bdgraph.sim function generates Gaussian, discrete, binary, and mixed data under multiple graph structures, with user control over graph sparsity.Supported structures include random, cluster, scale-free, lattice, hub, star, circle, AR(1), AR(2), and fixed graphs.Source: §2 · p. 3
- The bdgraph and bdgraph.mpl functions provide Bayesian estimation for Gaussian, Gaussian-copula, and discrete graphical models.These methods cover Gaussian data as well as non-Gaussian, discrete, binary, and mixed data.Source: §2 · pp. 3–4
- The package offers birth-death MCMC, reversible-jump MCMC, and hill-climbing search algorithms through its sampling functions.Source: §2 · p. 4
- Results functions select graphs, report posterior link and graph probabilities, monitor convergence, compare models with measures and ROC plots, and visualize data and estimated graphs.Source: §2 · p. 4
3. Methodological background
This section outlines Bayesian graph-estimation methods for Gaussian and heterogeneous data, then describes algorithms for exploring graph structures and sampling precision matrices.
3. Methodological background
- The package uses Gaussian graphical models for Gaussian data and Gaussian copula graphical models for non-Gaussian, discrete, or mixed data.It also describes discrete graphical models for discrete and binary data.Source: §3 · p. 4
3.1. Bayesian Gaussian graphical models
- In GGMs, conditional independence corresponds to zero entries in the precision matrix K, and the G-Wishart prior yields posterior W_G(b+n, D+S).Given a graph, K is restricted to positive-definite matrices whose entries outside the graph's edges are zero.Source: §3.1 · p. 5
Direct sampler from G-Wishart
- Algorithm 1 produces exact G-Wishart samples, and BDgraph implements it as rgwish for posterior precision-matrix sampling.The algorithm takes a graph and precision matrix as input and returns an exact sample from the precision matrix.Source: Direct sampler from G-Wishart · p. 6
BDMCMC algorithm for GGMs
- BDMCMC explores graph space through continuous-time link births and deaths, with rates designed to make the joint posterior its stationary distribution.Its Rao-Blackwellized estimator estimates graph probabilities from total waiting times; the birth-rate calculation is parallelized with OpenMP in C++.Source: BDMCMC algorithm for GGMs · pp. 7–8, Figure 2 · p. 8
3.2. Gaussian copula graphical models
- Gaussian copula models represent heterogeneous observed variables through latent Gaussian variables and their marginal distributions.When all variables are continuous, the margins are unique and zeros in K imply conditional independence; for discrete variables, the margins are not unique.Source: §3.2 · pp. 8–9
BDMCMC algorithm for GCGMs
- For GCGMs, BDMCMC first samples latent variables conditional on observed data, then uses the GGM graph and precision-matrix steps.When all variables are continuous, latent-variable sampling is unnecessary.Source: BDMCMC algorithm for GCGMs · p. 10
Alternative RJMCMC algorithm
- The alternative RJMCMC is a discrete-time trans-dimensional chain targeting the joint posterior, with acceptance probabilities proportional to BDMCMC birth and death rates.BDgraph also implements exact G-Wishart sampling and uses a result for the ratio of its normalizing constants.Source: Alternative RJMCMC algorithm · pp. 10–11
4. The BDgraph environment
BDgraph provides a comprehensive toolkit for Bayesian graphical models. Its environment covers posterior inference and graph selection alongside diagnostics, comparison, and simulation.
4.1. Posterior sampling
- bdgraph samples posterior graphs for Gaussian and Gaussian-copula models using default BDMCMC or alternative RJMCMC; bdgraph.mpl and bdgraph.ts cover pseudo-likelihood and time-series determination.Source: §4.1 · pp. 11–12
4.2. Posterior graph selection
- Graph selection offers BMA thresholded link inclusion and MAP highest-posterior graphs; MAP requires saving all adjacency matrices, which may cause memory problems.Source: §4.2 · p. 12
4.3. Convergence check
- plotcoda traces posterior link probabilities, while traceplot traces graph size and can display its autocorrelation and partial autocorrelation.Source: §4.3 · p. 13
4.4. Comparison and goodness-of-fit
- compare evaluates graph estimates with measures including balanced F-score, while plotroc visualizes ROC comparisons based on posterior link probabilities.Source: §4.4 · p. 13
4.5. Data simulation
- bdgraph.sim generates Gaussian, non-Gaussian, discrete, binary, and mixed data with varied graph structures; graph.sim generates graph structures separately.Source: §4.5 · p. 14
5. An example on simulated data
In a simulated Gaussian example, BDMCMC converges faster than RJMCMC, although the two algorithms have similar overall performance. The package summary also reports posterior estimates and visualizations of the sampled graphs.
5. An example on simulated data
- The comparison used 60 Gaussian observations on eight variables with a scale-free graph; both algorithms ran for 5,000 iterations, including 2,500 burn-in iterations.Source: §5 · pp. 14, 17
- For this run, computation took less than one second with intensive tasks implemented in C++ and interfaced with R.Source: §5 · p. 15
- The package summary reports the selected graph, link probabilities, and precision matrix, and visualizes more than 2,000 visited graphs, mainly with 4 to 18 links.Source: §5 · pp. 15–16, Figure 3 · p. 16
- Both algorithms have more or less the same performance on this specific simulated example.Source: Figure 4 · p. 17, §5 · p. 17
- BDMCMC converges faster than RJMCMC in this example, as indicated by traces of estimated posterior link probabilities.Source: Figure 5 · p. 18, §5 · p. 18
6. Application to real datasets
The package is applied to mixed labor-force data and non-Gaussian gene-expression data, illustrating graph estimation and visualization. The examples report specific associations, compare the labor-force result with Hoff (2007), and identify gene links consistent with earlier work as well as additional high-probability links.
6.1. Application to labor force survey data
- The labor-force example applies Gaussian copula graphical models to mixed-scale variables, using 10,000 iterations with 7,000 burn-in iterations.The data concern 1,002 U.S. males and include seven observed variables; missingness is about 9% overall, with higher rates for income and parental income.Source: §6.1 · pp. 18–19
- Income has positively correlated links with education, fertility, and age, each with posterior probability one; education and parental education are also positively related with probability one.Education and fertility are negatively correlated with posterior probability above 0.67.Source: §6.1 · p. 21
- BDgraph’s labor-force results match Hoff (2007) except for two links, including a strong parental-education–fertility relationship not selected by Hoff.Hoff assessed conditional independence by checking whether 95% credible intervals for associated regression parameters excluded zero.Source: §6.1 · p. 21
6.2. Application to human gene expression
- The gene-expression example applies Gaussian copula graphical models with a sparsity-encouraging Bernoulli link prior and reports runtime under three minutes.It analyzes the 100 most variable probes from data with 60 individuals.Source: §6.2 · pp. 21–22
- The gene-expression graph contains links consistent with earlier studies and additional high-posterior-probability interactions that may complement prior network analyses.The analysis uses 60 observations across 100 continuous, non-Gaussian genes; the selected graph contains 176 links with posterior probabilities above 0.5.Source: §6.2 · pp. 21–22
7. Conclusion
BDgraph supports Bayesian structure learning for decomposable and non-decomposable undirected graphical models. It implements methods for Gaussian data and Gaussian copula models for non-Gaussian, discrete, and mixed data; outlier handling is identified as a possible extension.
7. Conclusion
- BDgraph implements Bayesian structure learning for general undirected graphs, including decomposable and non-decomposable structures, across Gaussian and Gaussian copula models.The Gaussian copula methods cover non-Gaussian, discrete, and mixed data.Source: §7 · p. 22
- The authors identify robust Bayesian graphical modeling with Dirichlet t-distributions as a possible future extension for dealing with outliers.They describe such an implementation as desirable in actual applications.Source: §7 · p. 23
Appendix: Dealing with memory usage restriction
Storing every post-burn-in adjacency matrix constrains memory use, particularly for high-dimensional MAP estimation and convergence monitoring. The package reduces storage by encoding each graph’s upper-triangular adjacency entries as a character string.
Appendix: Dealing with memory usage restriction
- Memory use constrains Bayesian MAP estimation and convergence monitoring, especially in high-dimensional problems.With save = TRUE, bdgraph returns post-burn-in adjacency matrices for all iterations.Source: Appendix: Dealing with memory usage… · pp. 23–24
- The compact graph encoding uses 241.1 megabytes instead of 3.7 gigabytes for storing all adjacency matrices.It transfers each adjacency matrix’s upper-triangular part into one character string.Source: Appendix: Dealing with memory usage… · pp. 24–25
Journal of Statistical Software http://www.jstatsoft.org/
The supplied passage provides journal website and publication metadata.
Journal of Statistical Software http://www.jstatsoft.org/
- The passage names the American Statistical Association and its website, http://www.amstat.org/, and lists Volume 89, Issue 3, submitted 2015-07-24 and accepted 2016-04-20.Source: Journal of Statistical Software… · p. 29