Simulates a random Wishart-distributed matrix

rwish(S0, nu = dim(S0)[1] + 2)

Arguments

S0

a positive definite matrix

nu

a positive integer

Value

a positive definite matrix

Author

Peter Hoff

Examples

## The expectation is S0*nu S0<-rwish(diag(3)) SS<-matrix(0,3,3) for(s in 1:1000) { SS<-SS+rwish(S0,5) } SS/s
#> [,1] [,2] [,3] #> [1,] 14.004289 1.488621 3.573152 #> [2,] 1.488621 18.225362 -15.808489 #> [3,] 3.573152 -15.808489 62.796895
S0*5
#> [,1] [,2] [,3] #> [1,] 14.230080 1.888539 3.072212 #> [2,] 1.888539 19.355394 -17.076554 #> [3,] 3.072212 -17.076554 64.874748