blockBAGENI {baygel} | R Documentation |
Type I naive Bayesian adaptive graphical elastic net block Gibbs sampler for Gaussian graphical models.
Description
Implements the Type I naive Bayesian adaptive graphical elastic net block Gibbs sampler to simulate the posterior distribution of the precision matrix for Gaussian graphical models.
Usage
blockBAGENI(
X,
burnin,
iterations,
verbose = TRUE,
r = 0.001,
s = 0.01,
a = 0.001,
b = 0.1
)
Arguments
X |
A numeric matrix, assumed to be generated from a multivariate Gaussian distribution. |
burnin |
An integer specifying the number of burn-in iterations. |
iterations |
An integer specifying the length of the Markov chain after the burn-in iterations. |
verbose |
A logical determining whether the progress of the MCMC sampler should be displayed. |
r |
A double specifying the value of the shape parameter for the gamma prior associated with the Bayesian graphical lasso penalty term. |
s |
A double specifying the value of the scale parameter for the gamma prior associated with the Bayesian graphical lasso penalty term. |
a |
A double specifying the value of the shape parameter for the inverse gamma prior associated with the Bayesian graphical ridge penalty term. |
b |
A double specifying the value of the scale parameter for the inverse gamma prior associated with the Bayesian graphical ridge penalty term. |
Value
A list containing precision 'Omega' and covariance 'Sigma' matrices from the Markov chains.
Examples
# Generate true precision matrix:
p <- 10
n <- 500
OmegaTrue <- pracma::Toeplitz(c(0.7^rep(1:p-1)))
SigTrue <- pracma::inv(OmegaTrue)
# Generate expected value vector:
mu <- rep(0,p)
# Generate multivariate normal distribution:
set.seed(123)
X <- MASS::mvrnorm(n, mu = mu, Sigma = SigTrue)
# Generate posterior distribution:
posterior <- blockBAGENI(X, iterations = 1000, burnin = 500)
# Estimated precision matrix using the mean of the posterior:
OmegaEst <- apply(simplify2array(posterior$Omega), 1:2, mean)