bdgraph.dw {BDgraph}R Documentation

Search algorithm for Gaussian copula graphical models for count data

Description

This function consists of several sampling algorithms for Bayesian structure learning in undirected graphical models for count data. It is based on Gaussian copula graphical models with discrete Weibull distributed marginals. To speed up the computations, the birth-death MCMC sampling algorithms are implemented in parallel using OpenMP in C++.

Usage

bdgraph.dw( data, x = NULL, formula = y ~ ., 
            n = NULL, algorithm = "bdmcmc", iter = 5000, 
            burnin = iter / 2, g.prior = 0.2, df.prior = 3,
            ZI = FALSE, iter_bdw = 5000,
            g.start = "empty", jump = NULL, save = FALSE, 
            q = NULL, beta = NULL, pii = NULL,
            cores = NULL, threshold = 1e-8, verbose = TRUE )

Arguments

data

(n \times p) matrix or a data.frame corresponding to the data on the p nodes of the graph. It can also be an object of class "sim", from the function bdgraph.sim.

x

(n \times k) matrix or a data.frame corresponding to the predictors.

formula

object of class formula as a symbolic description of the model for linking each node to the predictors. For the case of data.frame, it is taken as the model frame (see model.frame).

n

number of observations. It is needed if the "data" is a covariance matrix.

algorithm

character with two options "bdmcmc" (default) and "rjmcmc". Option "bdmcmc" is based on a birth-death MCMC algorithm. Option "rjmcmc" is based on a reversible jump MCMC algorithm.

iter

number of iterations for the sampling algorithm for graph learning.

burnin

number of burn-in iterations for the sampling algorithm for graph learning.

g.prior

for determining the prior distribution of each edge in the graph. There are two options: a single value between 0 and 1 (e.g. 0.5 as a noninformative prior) or a (p \times p) matrix with elements between 0 and 1.

df.prior

degree of freedom for G-Wishart distribution, W_G(b,D), which is a prior distribution for the precision matrix.

ZI

logical. If FALSE (default), the conditional distribution of each response variable is assumed to be Discrete Weibull given the predictors x. If TRUE, a zero-inflated model will be applied to each response. ZI can be passed also as a vector, in order to specify which of the (p variables) should be fitted with zero-inflation (TRUE) or not (FALSE).

iter_bdw

number of iterations for the sampling algorithm to estimate the regression parameters for the Discrete Weibull distribution. It is passed to the bdw.reg function.

g.start

corresponds to a starting point of the graph. It could be an (p \times p) matrix, "empty" (default), or "full". Option "empty" means that the initial graph is an empty graph and "full" means a full graph. It also could be an object with S3 class "bdgraph" of R package BDgraph or the class "ssgraph" of R package ssgraph::ssgraph(); this option can be used to run the sampling algorithm from the last objects of the previous run (see examples).

jump

it is only for the BDMCMC algorithm (algorithm = "bdmcmc"). It is for simultaneously updating multiple links at the same time while updating the graph in the BDMCMC algorithm.

save

logical: if FALSE (default), the adjacency matrices are NOT saved. If TRUE, the adjacency matrices after burn-in are saved.

q, beta

parameters of the discrete Weibull distribution used for the marginals. They should be given either as a (n \times p) matrix (if covariates are present) or as a vector (if covariates are not present). If NULL (default), these parameters are estimated by the bdw.reg function.

pii

vector of zero-inflation parameters of the zero-inflated discrete Weibull distributions used for the marginals. If NULL (default), this parameter is estimated by the bdw.reg function when ZI = TRUE.

cores

number of cores to use for parallel execution. The case cores = "all" means all CPU cores to use for parallel execution.

threshold

threshold value for the convergence of the sampling algorithm from G-Wishart for the precision matrix.

verbose

logical: if TRUE (default), report/print the MCMC running time.

Value

An object with S3 class "bdgraph" is returned, containing:

p_links

upper triangular matrix corresponding to the estimated posterior probabilities of all possible links.

K_hat

posterior estimation of the precision matrix.

sample_marginals

posterior samples of the regression coefficients of the marginal distributions.

For the case "save = TRUE", the code returns:

sample_graphs

vector of strings which includes the adjacency matrices of the graphs visited after burn-in.

graph_weights

vector which includes the waiting times of the graphs visited after burn-in.

all_graphs

vector which includes the identity of the adjacency matrices for all iterations after burn-in. It is needed for monitoring the convergence of the BDMCMC algorithm.

all_weights

vector which includes the waiting times for all iterations after burn-in. It is needed for monitoring the convergence of the BDMCMC algorithm.

Author(s)

Reza Mohammadi a.mohammadi@uva.nl, Veronica Vinciotti, and Pariya Behrouzi

References

Vinciotti, V., Behrouzi, P., and Mohammadi, R. (2022) Bayesian structural learning of microbiota systems from count metagenomic data, arXiv preprint, doi:10.48550/arXiv.2203.10118

Peluso, A., Vinciotti, V., and Yu, K. (2018) Discrete Weibull generalized additive model: an application to count fertility, Journal of the Royal Statistical Society: Series C, 68(3):565-583, doi:10.1111/rssc.12311

Haselimashhadi, H., Vinciotti, V., and Yu, K. (2018) A novel Bayesian regression model for counts with an application to health data, Journal of Applied Statistics, 45(6):1085-1105, doi:10.1080/02664763.2017.1342782

Mohammadi, R. and Wit, E. C. (2019). BDgraph: An R Package for Bayesian Structure Learning in Graphical Models, Journal of Statistical Software, 89(3):1-30, doi:10.18637/jss.v089.i03

Mohammadi, A. and Wit, E. C. (2015). Bayesian Structure Learning in Sparse Gaussian Graphical Models, Bayesian Analysis, 10(1):109-138, doi:10.1214/14-BA889

Mohammadi, A. et al (2017). Bayesian modelling of Dupuytren disease by using Gaussian copula graphical models, Journal of the Royal Statistical Society: Series C, 66(3):629-645, doi:10.1111/rssc.12171

Mohammadi, R., Massam, H. and Letac, G. (2021). Accelerating Bayesian Structure Learning in Sparse Gaussian Graphical Models, Journal of the American Statistical Association, doi:10.1080/01621459.2021.1996377

See Also

bdgraph, bdgraph.mpl, bdw.reg, bdgraph.sim, summary.bdgraph, compare

Examples

## Not run: 
# - - Example 1

# Generating multivariate Discrete Weibull data based on 'random' graph
data.sim <- bdgraph.sim( n = 100, p = 10, type = "dw", vis = TRUE )

bdgraph.obj <- bdgraph.dw( data = data.sim, iter = 5000 )

summary( bdgraph.obj )

# To compare the result with true graph
compare( bdgraph.obj, data.sim, main = c( "Target", "BDgraph" ), vis = TRUE )

# - - Example 2

# Generating multivariate Discrete Weibull data based on a 'scale-free' graph
data.sim <- bdgraph.sim( n = 100, p = 10, type = "dw", graph = "scale-free", vis = TRUE )

bdgraph.obj <- bdgraph.dw( data = data.sim, iter = 10000 )

summary( bdgraph.obj )

compare( bdgraph.obj, data.sim, main = c( "Target", "BDgraph" ), vis = TRUE )

## End(Not run)	  

[Package BDgraph version 2.72 Index]