 # Drawing from Inverse Wishart Distribution

Hi,

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)

0

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

1,728

0

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;
retp(inv(d));
endp;
_______________________

*******************************

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

______________________ 0

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

1,728

0

Hi, Any update on this? 0

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

1,728

0

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)$$

then

$$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'$$

and

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

90

0

The reference to a covariance matrix is a mistake in the documentation. The first input to rndWishartInv should be the scale matrix. aptech
1,728
0

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;
retp(inv(d));
endp;
_______________________

*******************************

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

______________________ 0

I will bring this to one of our econometricians and let you know what they say. aptech
1,728
0

Hi, Any update on this? 0

Someone is looking into this for me. I should hear back within a couple of days. aptech
1,728
0

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)$$

then

$$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'$$

and

$$W(\Sigma, n) = ATT'A'$$ ### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.