Command Reference : Function Reference : Function Reference: R
  
 
@riwish
Inverse Wishart random draws.
Syntax: @riwish(S, n)
@riwishc(S, n)
@riwishi(S, n)
@riwishic(S, n)
@riwish(X, S, n)
@riwishc(X, S, n)
@riwishi(X, S, n)
@riwishic(X, S, n)
X: (optional) sym,
S: sym, matrix,
n: number,
Return: sym
Draw a random symmetric inverse Wishart matrix using the density function.
The inverse Wishart density is given by
 
(18.8)
where and are symmetric matrices, and .
There are four different forms of the function, corresponding to different ways of specifying . The forms are distinguished by different suffixes that are applied to the base “@rwish” command and how they change the interpretation of the S matrix argument:
 
@riwish
“”
Supply .
@riwishc
“c”
Supply the Cholesky decomposition of .
This form is more efficient when performing multiple draws from the same distribution (compute the Cholesky once, but sample many times).
@riwishi
“i”
Supply .
This form is more efficient than explicitly inverting to supply .
@riwishic
“ic”
Supply the Cholesky decomposition of .
This form combines the efficiencies of the Cholesky and inverse forms.
Note that if is an inverse Wishart random variable, then is follows a Wishart distribution:
Examples
= @riwish(@identity(3), 5)
returns a random draw from the distribution.
Cross-references
See also @dwish, @rwish, and @diwish.