baygel

Overview

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.

Installation

You can install the latest version from CRAN using:

install.packages("baygel")

Loading

library(baygel)

Simple example

library(baygel)

# 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)
posterior     <- blockBSGR(X,iterations = 1000, burnIn = 500)