Skip to Main Menu

A Quick Note about rInvWishart in CholWishart

People wanting to simulate from the inverse Wishart may want their inverses to be the exact inverses of what are generated by rWishart or may be wondering about how, exactly, rInvWishart is parameterized. You might expect that simulating from rWishart with a covariance matrix Sigma gives results related to simulating from rInvWishart with covariance Sigma or you might want it with covariance Sigma^(-1). So which is it?

library('CholWishart')
A <- 1.0 * toeplitz(5:1)
set.seed(20190109)
B <- rWishart(1, 10, A)[,,1]
set.seed(20190109)
C <- rInvWishart(1,10,solve(A))[,,1]
B %*% C
##              [,1]          [,2]          [,3]          [,4]          [,5]
## [1,] 1.000000e+00 -6.161738e-15  6.911138e-15 -3.969047e-15  2.192690e-15
## [2,] 3.719247e-15  1.000000e+00  5.662137e-15 -2.886580e-15  2.553513e-15
## [3,] 1.554312e-15 -1.887379e-15  1.000000e+00 -1.776357e-15  4.440892e-16
## [4,] 1.110223e-16  4.440892e-16 -2.220446e-16  1.000000e+00 -4.440892e-16
## [5,] 4.440892e-16  8.881784e-16  0.000000e+00  0.000000e+00  1.000000e+00

Use Sigma^(-1).