blockBGR {baygel}R Documentation

Bayesian graphical ridge block Gibbs sampler for Gaussian graphical models.

Description

Implements a Bayesian graphical ridge block Gibbs sampler to simulate the posterior distribution of the precision matrix for Gaussian graphical models.

Usage

blockBGR(X, burnin, iterations, sig = 1, verbose = TRUE)

Arguments

X

A numeric matrix, assumed to be generated from a multivariate Gaussian distribution.

burnin

An integer representing the number of burn-in iterations.

iterations

An integer representing the length of the Markov chain post burn-in.

sig

A numeric value representing the standard deviation parameter for the double Gaussian and truncated Gaussian prior.

verbose

A logical indicating if the MCMC sampler progress should be printed.

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     <- blockBGR(X, iterations = 1000, burnin = 500, sig = 0.5)
# Estimated precision matrix using the mean of the posterior:
OmegaEst      <- apply(simplify2array(posterior$Omega), 1:2, mean)

[Package baygel version 0.3.0 Index]