bayesMvLMconjugate: Gibbs sampler for Conjugate Bayesian Multivariate Linear...

View source: R/bayesMvLMconjugate.R

bayesMvLMconjugateR Documentation

Gibbs sampler for Conjugate Bayesian Multivariate Linear Models

Description

Gibbs sampler for Conjugate Bayesian Multivariate Linear Models

Usage

bayesMvLMconjugate(Y, X, mu_B, V_B, nu, Psi, n_iter = 1000, burn_in = 500)

Arguments

Y

matrix n \times q of response variables

X

matrix n \times p of predictors

mu_B

matrix p \times q prior mean for \beta

V_B

matrix p \times p prior row covariance for \beta

nu

double prior parameter for \Sigma

Psi

matrix prior parameter for \Sigma

n_iter

integer iteration number for Gibbs sampler

burn_in

integer number of burn-in iteration

Value

B_samples array of posterior sample for \beta

Sigma_samples array of posterior samples for \Sigma

Examples

## Generate data
n <- 100
p <- 3
q <- 2
Y <- matrix(rnorm(n*q), nrow = n, ncol = q)
X <- matrix(rnorm(n*p), nrow = n, ncol = p)

## Prior parameters
mu_B <- matrix(0, p, q)
V_B <- diag(10, p)
nu <- 3
Psi <- diag(q)

## Samples from posteriors
n_iter <- 1000
burn_in <- 500
set.seed(1234)
samples <- spBPS::bayesMvLMconjugate(Y, X, mu_B, V_B, nu, Psi, n_iter, burn_in)


spBPS documentation built on Oct. 25, 2024, 5:07 p.m.