Normal-inverse-Wishart distribution
In probability theory and statistics, the normal-inverse-Wishart distribution (or Gaussian-inverse-Wishart distribution) is a multivariate four-parameter family of continuous probability distributions. It is the conjugate prior of a multivariate normal distribution with unknown mean and covariance matrix (the inverse of the precision matrix). Definition. Suppose has a multivariate normal distribution with mean formula_2 and covariance matrix formula_3, where has an inverse Wishart distribution. Then formula_5 has a normal-inverse-Wishart distribution, denoted as Characterization. Probability density function. The full version of the PDF is as follows: formula_8 Here formula_9 is the multivariate  gamma function and formula_10 is the Trace of the given matrix. Properties. Marginal distributions. By construction, the marginal distribution over formula_11 is an inverse Wishart distribution, and the conditional distribution over formula_12 given formula_11 is a multivariate normal distribution. The marginal distribution over formula_12 is a multivariate t-distribution. Posterior distribution of the parameters. Suppose the sampling density is a multivariate normal distribution where formula_16 is an formula_17 matrix and formula_18 (of length formula_19) is row formula_20 of the matrix . With the mean and covariance matrix of the sampling distribution is unknown, we can place a Normal-Inverse-Wishart prior  on the mean and covariance parameters jointly The resulting posterior distribution for the mean and covariance matrix will also be a Normal-Inverse-Wishart where To sample from the joint posterior of formula_27, one simply draws samples from formula_28, then draw formula_29. To draw from the posterior predictive of a new observation, draw formula_30 , given the already drawn values of formula_12 and formula_11. Generating normal-inverse-Wishart random variates. Generation of random variates is straightforward: