Description Usage Arguments Value References Examples
View source: R/BayesGlassoBlock.R
A Bayesian adaptive graphical lasso data-augmented block Gibbs sampler. The sampler is adapted from the MATLAB routines used in Wang (2012).
1 | 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.
1 2 3 4 5 6 7 8 9 10 11 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.