# NOT RUN {
rate <- crossprod(matrix(rnorm(15),5,3)) #the prior inverse-scale
m <- matrix(0,3,3)
## get 1000 samples and calculate the sample mean
for(i in 1:100){
m <- m+rWishart(df=5,rate=rate)/100
}
## m should roughly equal to df*inverse(rate):
m
pdsInverse(rate)*5
## try generating samples with 'rate' parameter:
scale <- pdsInverse(rate)
m2 <- matrix(0,3,3)
for(i in 1:100){
m2 <- m2+rWishart(df=5,scale=scale)/100
}
## m2 should roughly equal df*scale:
m2
5*scale
# }
Run the code above in your browser using DataLab