View source: R/bayesMvLMconjugate.R
bayesMvLMconjugate | R Documentation |
Gibbs sampler for Conjugate Bayesian Multivariate Linear Models
bayesMvLMconjugate(Y, X, mu_B, V_B, nu, Psi, n_iter = 1000, burn_in = 500)
Y |
matrix |
X |
matrix |
mu_B |
matrix |
V_B |
matrix |
nu |
double prior parameter for |
Psi |
matrix prior parameter for |
n_iter |
integer iteration number for Gibbs sampler |
burn_in |
integer number of burn-in iteration |
B_samples array of posterior sample for \beta
Sigma_samples array of posterior samples for \Sigma
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.