Title: | Adaptive Bayesian Graphical Lasso |
---|---|
Description: | Implements a Bayesian adaptive graphical lasso data-augmented block Gibbs sampler. The sampler simulates the posterior distribution of precision matrices of a Gaussian Graphical Model. This sampler was adapted from the original MATLAB routine proposed in Wang (2012) <doi:10.1214/12-BA729>. |
Authors: | Jarod Smith [aut, cre]
|
Maintainer: | Jarod Smith <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2025-02-22 04:40:00 UTC |
Source: | https://github.com/cran/abglasso |
A Bayesian adaptive graphical lasso data-augmented block Gibbs sampler. The sampler is adapted from the MATLAB routines used in Wang (2012).
BayesGlassoBlock(X, burnin = 1000, nmc = 2000)
BayesGlassoBlock(X, burnin = 1000, nmc = 2000)
X |
Numeric matrix. |
burnin |
An integer specifying the number of burn-in iterations. |
nmc |
An integer specifying the number of MCMC samples. |
list containing:
A p
by p
by nmc
array of saved posterior samples of covariance matrices.
A p
by p
by nmc array of saved posterior samples of precision matrices.
A 1 by nmc
vector of saved posterior samples of lambda values.
Wang, H. (2012). Bayesian graphical lasso models and efficient posterior computation. Bayesian Analysis, 7(4). doi:10.1214/12-BA729.
# Generate true covariance matrix: p <- 10 n <- 50 SigTrue <- pracma::Toeplitz(c(0.7^rep(1:p-1))) CTrue <- pracma::inv(SigTrue) # Generate expected value vector: mu <- rep(0,p) # Generate multivariate normal distribution: set.seed(123) X <- MASS::mvrnorm(n,mu=mu,Sigma=SigTrue) abglasso_post <- BayesGlassoBlock(X,burnin = 1000,nmc = 2000)
# Generate true covariance matrix: p <- 10 n <- 50 SigTrue <- pracma::Toeplitz(c(0.7^rep(1:p-1))) CTrue <- pracma::inv(SigTrue) # Generate expected value vector: mu <- rep(0,p) # Generate multivariate normal distribution: set.seed(123) X <- MASS::mvrnorm(n,mu=mu,Sigma=SigTrue) abglasso_post <- BayesGlassoBlock(X,burnin = 1000,nmc = 2000)