Description Usage Arguments Details Value Examples
Samples the inverse-Wishart distribution.
1 | rinvwishart(n, nu, Omega, epsilon = 0, checkSymmetry = TRUE)
|
n |
sample size, a positive integer |
nu |
degrees of freedom, must satisfy |
Omega |
scale matrix, a positive definite real matrix |
epsilon |
threshold to force invertibility in the algorithm; see Details |
checkSymmetry |
logical, whether to check the symmetry of |
The inverse-Wishart distribution with scale matrix
Ω is
defined as the inverse of the Wishart distribution with scale matrix
Ω-1
and same number of degrees of freedom.
The argument epsilon
is a threshold whose role is to guarantee
the invertibility of the sampled Wishart distributions.
See Details in rwishart
.
A numeric three-dimensional array; simulations are stacked along the third dimension (see example).
1 2 3 4 5 6 7 8 9 10 11 | nu <- 6
p <- 3
Omega <- toeplitz(p:1)
IWsims <- rinvwishart(10000, nu, Omega)
dim(IWsims) # 3 3 10000
apply(IWsims, 1:2, mean) # approximately Omega/(nu-p-1)
# the epsilon argument:
IWsims <- tryCatch(rinvwishart(10000, nu=p+0.001, Omega),
error=function(e) e)
IWsims <- tryCatch(rinvwishart(10000, nu=p+0.001, Omega, epsilon=1e-8),
error=function(e) e)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.