How to sample from the product of a Gaussian and an inverse-Wishart distribution?

How do I sample from a distribution that is the product of a gaussian and an inverse-wishart distribution? I was going to use inverse transform sampling but a friend said that he thinks there is a much simpler way of doing it, a trick because the inverse-wishart is a conjugate prior of the gaussian. Does anyone know if there is an easy way to do this? Thanks very much!

• I have recently encountered this question too. Did you solved this problem by now? I am wondering whether there is any matlab code to share? It would be a great help to me! Thank you. – user18629 Jan 13 '13 at 16:20

A Paper by Bodnar and Okhrin nearly solves this for you. If $A$ is Wishart, $z$ is multivariate Gaussian, and $l$ is a conformable vector, they give the distribution for $l^{\top}A^{-1}z$. It is a bit involved:
$$l^{\top}A^{-1}z = \frac{1}{u_1}\left(l^{\top}\Sigma^{-1}\mu + u_2 \sqrt{\left(\lambda + \frac{\lambda(k-1)}{n-k+2}u_3\right)l^{\top}\Sigma^{-1}l}\right),$$
where $u_i$ are independent, $u_1\sim\chi^2_{n-k+1},u_2\sim\mathcal{N}(0,1),u_3\sim F\left((k-1)/2,(n-k+2)/2,s/\lambda\right),$ where $A$ is a k-variate Wishart with parameter $\Sigma$ and $n$ degrees of freedom, and $z$ is multivariate Gaussian with mean $\mu$ and covariance $\lambda\Sigma$. The parameter $s =\mu^{\top}R_l\mu$, where $R_l$ is underdefined in the paper; I think it is supposed to be $R_l = \Sigma^{-1} - \Sigma^{-1}ll^{\top}\Sigma^{-1} / l^{\top}\Sigma^{-1}l$.
• I wasn't sure if you wanted the distribution of the vector $A^{-1}z$, or if $L A^{-1}z$ would work for matrix (or vector) $L$. For vector $L$, the Bodnar & Okhrin trick will generate variates for you. O/w, good luck. Let me know how that works out. – shabbychef May 5 '12 at 23:02