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 |
( |
x |
( |
formula |
object of class formula as a symbolic description of the model for linking each node to the predictors. For the case of |
n |
number of observations. It is needed if the " |
algorithm |
character with two options " |
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 |
df.prior |
degree of freedom for G-Wishart distribution, |
ZI |
logical. If FALSE (default), the conditional distribution of each response variable is assumed to be Discrete Weibull given the predictors |
iter_bdw |
number of iterations for the sampling algorithm to estimate the regression parameters for the Discrete Weibull distribution. It is passed to the |
g.start |
corresponds to a starting point of the graph. It could be an ( |
jump |
it is only for 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 ( |
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 |
cores |
number of cores to use for parallel execution.
The case |
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)