conjugateLinearModel: Solve Bayesian Multivariate Conjugate Linear Model

View source: R/RcppExports.R

conjugateLinearModelR Documentation

Solve Bayesian Multivariate Conjugate Linear Model

Description

See details for model. Notation: N is number of samples, D is the dimension of the response, Q is number of covariates.

Usage

conjugateLinearModel(Y, X, Theta, Gamma, Xi, upsilon, n_samples = 2000L)

Arguments

Y

matrix of dimension D x N

X

matrix of covariates of dimension Q x N

Theta

matrix of prior mean of dimension D x Q

Gamma

covariance matrix of dimension Q x Q

Xi

covariance matrix of dimension D x D

upsilon

scalar (must be > D-1) degrees of freedom for InvWishart prior

n_samples

number of samples to draw (default: 2000)

Details

Y \sim MN_{D-1 \times N}(\Lambda \mathbf{X}, \Sigma, I_N)

\Lambda \sim MN_{D-1 \times Q}(\Theta, \Sigma, \Gamma)

\Sigma \sim InvWish(\upsilon, \Xi)

This function provides a means of sampling from the posterior distribution of Lambda and Sigma.

Value

List with components

  1. Lambda Array of dimension (D-1) x Q x n_samples (posterior samples)

  2. Sigma Array of dimension (D-1) x (D-1) x n_samples (posterior samples)

Examples

sim <- pibble_sim()
eta.hat <- t(alr(t(sim$Y+0.65)))
fit <- conjugateLinearModel(eta.hat, sim$X, sim$Theta, sim$Gamma, 
                            sim$Xi, sim$upsilon, n_samples=2000)

fido documentation built on June 22, 2024, 9:36 a.m.