lab:blog

# Wishart prior in WinBUGS/OpenBUGS

For a multilevel model, we specify the random coefficients as a multivariate normal distribution such as $\left(\begin{array}{c} L_{i}\\ S_{i}\end{array}\right)\sim MN\left[\left(\begin{array}{c} \beta_{L}\\ \beta_{S}\end{array}\right),\Sigma^{-1}\right]$

The prior for the precision matrix $\Sigma^{-1}$ is given a Wishart distribution in BUGS.

$\Sigma^{-1}\sim W(R[1:2,1:2],m)$

Here $m$ is the degrees of freedom (scalar) that is equivalent prior sample size and must be greater than or equal to dimension of matrix in order for Wishart to be proper. $m$ determines the degree of certainty you have about the mean.

In WinBUGS, the specification indicate that the mean of the covariance matrix (not the precision matrix) is

$E(\Sigma^{-1})=mR^{-1}$

In WinBUGS notation, if the precision matrix $P=\Sigma^{-1}$ follows a Wishart distribution $W(R,m)$, then

$E(P_{ij})=mR_{ij}^{-1}$

$Var(P_{ij})=m(R_{ij}^{-2}+R_{ii}^{-1}R_{jj}^{-1})$

$Cov(P_{ij},P_{kl})=m(R_{ik}^{-1}R_{jl}^{-1}+R_{il}^{-1}R_{jk}^{-1})$

### An intuitive way to specify the Wishart prior

• Let $S$ equal the prior guess for the mean of the $p\times p$ variance/covariance matrix $\Sigma$.
• Choose a degrees-of-freedom parameter $m (> p + 1)$ that roughly represents an “equivalent prior sample size” – your belief in $S$ as the value of $\Sigma$ is as strong as if you had seen $m$ previous vectors with sample covariance matrix $S$.
• Define a matrix $R=(m-p-1)S$.
• In WinBUGS, put the following Wishart prior on the corresponding precision matrix $P=\Sigma^{-1}$
Inv_sig~dwish(R, m)
• Based on this specification,
• $E(\Sigma) = S$
• $E(\Sigma^{-1}) = \frac{m}{m-p-1}S^{-1}$
• the variance of the prior will be decreasing in $m$