# IndependentInverseGamma

final class IndependentInverseGamma(α:Expression<Real>, β:Expression<Real[_]>) < Distribution<Real[_]>

Multivariate inverse-gamma distribution with independent components.

This is typically used to establish a conjugate prior for a Bayesian multivariate linear regression with $O$ number of outputs that are conditionally independent given the inputs:

\begin{align*} \sigma^2_o &\sim \Gamma^{-1}(\alpha_o, \beta_o) \\ \boldsymbol{\Sigma} &= \mathrm{diag} \left(\sigma^2_1 \cdots \sigma^2_O \right) \\ \mathbf{W} &\sim \mathcal{MN}(\mathbf{M}, \mathbf{A}, \boldsymbol{\Sigma}) \\ \mathbf{Y} &\sim \mathcal{N}(\mathbf{X}\mathbf{W}, \boldsymbol{\Sigma}), \end{align*}

where subscript $o$ denotes the (hyper)parameters of the $o$th element of the output vector, $\mathbf{X}$ are inputs, and $\mathbf{Y}$ are outputs.

The relationship is established in code as follows:

σ2:Random<Real[_]>;
α:Real;
β:Real[_];
W:Random<Real[_,_]>;
M:Real[_,_];
U:Real[_,_];
Y:Random<Real[_,_]>;
X:Real[_,_];

σ2 ~ InverseGamma(α, β);
W ~ Gaussian(M, U, σ2);
Y ~ Gaussian(X*W, σ2);


The advantage of using this approach over $O$ separate regressions is that expensive covariance operations are shared.

### Member Variables

Name Description
α:Expression<Real> Shape.
β:Expression<Real[_]> Scales.