Learn R Programming

BDgraph

Overview

The R package BDgraph provides statistical tools for Bayesian structure learning for undirected graphical models with continuous, count, binary, and mixed data. The package is implemented the recent improvements in the Bayesian graphical models' literature, including Mohammadi and Wit (2015), Mohammadi et al. (2023), Mohammadi et al. (2017), and Dobra and Mohammadi (2018). Besides, the package contains several functions for simulation and visualization, as well as several multivariate datasets taken from the literature. To speed up the computations, the computationally intensive tasks of the package are implemented in C++ in parallel using OpenMP.

Installation

You can install the latest version from CRAN using:

install.packages("BDgraph")

Loading

library(BDgraph)

Simple Examples for BDgraph package

To see how to use the functionality of the package:

See also Mohammadi and Wit (2019).

Copy Link

Version

Install

install.packages('BDgraph')

Monthly Downloads

2,272

Version

2.74

License

GPL (>= 2)

Maintainer

Abdolreza Mohammadi

Last Published

August 29th, 2025

Functions in BDgraph (2.74)

adj2link

Extract links from an adjacency matrix
bdgraph.npn

Nonparametric transfer
bdgraph.mpl

Search algorithm in graphical models using marginal pseudo-likehlihood
bdgraph

Search algorithm in graphical models
bdw.reg

Bayesian estimation of (zero-inflated) Discrete Weibull regression
bdgraph.sim

Graph data simulation
link2adj

Extract links from an adjacency matrix
covariance

Estimated covariance matrix
auc

Compute the area under the ROC curve
BDgraph-package

Bayesian Structure Learning in Graphical Models
bdgraph.dw

Search algorithm for Gaussian copula graphical models for count data
conf.mat.plot

Plot Confusion Matrix
geneExpression

Human gene expression dataset
mse

Graph structure comparison
compare

Graph structure comparison
bf

Bayes factor for two graphs
predict.bdgraph

Predict function for S3 class "bdgraph"
gnorm

Normalizing constant for G-Wishart
graph.sim

Graph simulation
precision

Estimated precision matrix
Discrete Weibull

The Discrete Weibull Distribution (Type 1)
conf.mat

Confusion Matrix
plotcoda

Convergence plot
plotroc

ROC plot
pgraph

Posterior probabilities of the graphs
posterior.predict

Posterior Predictive Samples
plot.bdgraph

Plot function for S3 class "bdgraph"
plot.sim

Plot function for S3 class "sim"
reinis

Risk factors of coronary heart disease
plot.graph

Plot function for S3 class "graph"
rmvnorm

Generate data from the multivariate Normal distribution
rgwish

Sampling from G-Wishart distribution
print.bdgraph

Print function for S3 class "bdgraph"
print.sim

Print function for S3 class "sim"
select

Graph selection
rwish

Sampling from Wishart distribution
summary.bdgraph

Summary function for S3 class "bdgraph"
surveyData

Labor force survey data
traceplot

Trace plot of graph size
sparsity

Compute the sparsity of a graph
transfer

transfer for count data
plinks

Estimated posterior link probabilities
roc

Build a ROC curve