# dist.Scaled.Inverse.Wishart: Scaled Inverse Wishart Distribution In LaplacesDemon: Complete Environment for Bayesian Inference

## Description

These functions provide the density and random number generation for the scaled inverse Wishart distribution.

## Usage

 ```1 2``` ``` dsiw(Q, nu, S, zeta, mu, delta, log=FALSE) rsiw(nu, S, mu, delta) ```

## Arguments

 `Q` This is the symmetric, positive-definite k x k matrix \textbf{Q}. `nu` This is the scalar degrees of freedom, nu regarding \textbf{Q}. The default recommendation is `nu=k+1`. `S` This is the symmetric, positive-semidefinite k x k scale matrix S regarding \textbf{Q}. The default recommendation is `S=diag(k)`. `zeta` This is a positive-only vector of length k of auxiliary scale parameters zeta. `mu` This is a vector of length k of location hyperparameters mu regarding zeta. `delta` This is a positive-only vector of length k of scale hyperparameters delta regarding zeta. `log` Logical. If `log=TRUE`, then the logarithm of the density is returned.

## Details

• Application: Continuous Multivariate

• Density: (see below)

• Inventor: O'Malley and Zaslavsky (2005)

• Notation 1: p(Sigma) ~ SIW(Q, nu, S, zeta, mu, delta)

• Notation 2: p(Sigma) = SIW(Sigma | Q, nu, S, zeta, mu, delta)

• Parameter 1: symmetric, positive-definite k x k matrix Q

• Parameter 2: degrees of freedom nu

• Parameter 3: symmetric, positive-semidefinite k x k scale matrix S

• Parameter 4: Auxiliary scale parameter vector zeta

• Parameter 5: Hyperparameter location vector mu

• Parameter 6: Hyperparameter scale vector delta

• Mean:

• Variance:

• Mode:

The scaled inverse Wishart (SIW) distribution is a prior probability distribution for a covariance matrix, and is an alternative to the inverse Wishart distribution.

While the inverse Wishart distribution is applied directly to covariance matrix Sigma, the SIW distribution is applied to a decomposed matrix \textbf{Q} and diagonal scale matrix zeta. For information on how to apply it to \textbf{Q}, see the example below.

SIW is more flexible than the inverse Wishart distribution because it has additional, and some say somewhat redundant, scale parameters. This makes up for one limitation of the inverse Wishart, namely that all uncertainty about posterior variances is represented in one parameter. The SIW prior may somewhat alleviate the dependency in the inverse Wishart between variances and correlations, though the SIW prior still retains some of this relationship.

The Huang-Wand (`dhuangwand`) prior is a hierarchical alternative.

## Value

`dsiw` gives the density and `rsiw` generates random deviates.

## References

O'Malley, A.J. and Zaslavsky, A.M. (2005), "Domain-Level Covariance Analysis for Survey Data with Structured Nonresponse".

`dhuangwand`, `dinvwishartc`, `dmvn`, and `dwishart`.
 ```1 2 3 4 5 6 7 8 9``` ```library(LaplacesDemon) ### In the model specification function, input U and zeta, then: # Q <- t(U) %*% U # Zeta <- diag(zeta) # Sigma <- Zeta %*% Q %*% Zeta # Sigma.prior <- dsiw(Q, nu=Data\$K+1, S=diag(Data\$K), zeta, mu=0, delta=1) ### Examples x <- dsiw(diag(3), 4, diag(3), runif(3), rep(0,3), rep(1,3), log=TRUE) x <- rsiw(4, diag(3), rep(0,3), rep(1,3)) ```