The R
package baygel provides a Markov
chain Monte Carlo (MCMC) sampler to return the posterior distribution of
precision matrices for Gaussian distributed data with
positive definite covariance matrix. The package is implemented
within the following literature, including Smith et
al. (2022). The MCMC sampler is implemented in C++
using RcppArmadillo.
You can install the latest version from CRAN using:
install.packages("baygel")
library(baygel)
library(baygel)
# Generate true covariance matrix:
<- 10
p <- 50
n <- pracma::Toeplitz(c(0.7^rep(1:p-1)))
SigTrue <- pracma::inv(SigTrue)
CTrue # Generate expected value vector:
<- rep(0,p)
mu # Generate multivariate normal distribution:
set.seed(123)
<- MASS::mvrnorm(n,mu=mu,Sigma=SigTrue)
X <- blockBSGR(X,iterations = 1000, burnIn = 500) posterior