Drawing from Inverse Wishart Distribution


For a random draw from InverseWishart distribution, i need to give "Covariance" matrix as an input. Whay can't it take scale matrix as an input instead? Is there any way to just use scale matrix and degrees of freedom to draw from an InverWishart by using: rndWishartInv(cov, df)

6 Answers


The reference to a covariance matrix is a mistake in the documentation. The first input to rndWishartInv should be the scale matrix.


Are you sure? Then these two routines should give the same result, but they do not! Can you check and let us know? Will appreciate your help


proc GEN(a, b);
local d, s;
b = a' - b;
d= b'b + 10*eye(10);
s = ((chol(inv(d))') * rndn(10, (10+1000))';
d= s's;


proc GEN_(a, b);
local s;
local scl,dof;
s = a' - b;
scl=((b'b) + 10*eye(10))./dof;
retp(rndWishartInv(scl, dof));



I will bring this to one of our econometricians and let you know what they say.


Hi, Any update on this?


Someone is looking into this for me. I should hear back within a couple of days.


We've looked further into our rndWishartInv procedure. The rndWishartInv procedure is based on the relationship between the inverse Wishart distribution and the Wishart distribution. More specifically, it is based on the fact that $A\sim W(\Sigma, v)$ then $X = A^{-1}$ follows the inverse Wishart distribution $X \sim W^{-1}(\Sigma^{-1}, v)$.

Our rndWishartInv procedure draws directly using our rndWishart function:

rndWishartInv = invpd(rndWishart(1, invpd(scale), df));

Our rndWishart procedure computes the Wishart draws based on the Odell and Feiveson (1966) methodology.

First, note that if,

$$W(d,n) = W(I_d, d, d)$$


$$W(\Sigma, n0 = A W(I_d, d, n) A'$$

where $A$ is the Cholesky decomposition of $\Sigma$.

Second, we can find $W(d, n)$ based on the Bartlett Decomposition. This method states that if we define a lower-diagonal matrix $T$, such the that below diagonal elements are drawn from the standard normal distribution and the diagonal elements are the square roots of the chi-squared random variables such that

$$T_{ii} = \sqrt(V_i)$$ $$V_i \sim \chi^2(n - i +1)$$

then we can find

$$W(d,n) = TT'$$


$$W(\Sigma, n) = ATT'A'$$

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy