Dear Ed,

I think the discrepancy you are seeing is due to a change in parameterization of the inverse Wishart distribution in MCMCpack from MCMCpack version 0.6-1 to 0.6-2 and later. Starting in 0.6-2 we've parameterized the inverse Wishart in the same way as in Appendix A of Gelman, Carlin, Stern, and Rubin, _Bayesian Data Analyis_. In particular, under this parameterization if W ~ InvWIsh(nu, S) then the expected value of W is S * (1/(nu-p-1)) where S is a p by p matrix. This is in the MCMCpack documentation.

In your example below, I think that simply using the inverse of lam in the call to the new version of riwish() will give you the result you were expecting.

Hope this helps.

Best,
KQ


From: Ed Merkle <[EMAIL PROTECTED]>
Date: April 28, 2005 11:39:26 AM CDT
To: [email protected]
Subject: [R] riwish() problem

R users-

In moving from R 2.0.0 to R 2.1.0 in Windows, I have encountered a problem with the "riwish" command in the package "MCMCpack". I've searched the documentation and can't seem to figure it out. For example:

Define a matrix:
> lam <- matrix(c(.00233,-.00057,-.00057,.00190),2,2)

and then use the riwish command to generate a random inverse-Wishart variate:
> riwish(72,lam)


In version 2.1.0, the result is a matrix of very small numbers like:
              [,1]          [,2]
[1,]  3.323499e-05 -3.417600e-06
[2,] -3.417600e-06  2.283511e-05

In version 2.0.0, the result is a matrix of larger numbers like:
         [,1]     [,2]
[1,] 9.707082 2.228333
[2,] 2.228333 9.037631

This result is consistent across random variates, so I don't think that random variability is the culprit. I suspect that the version 2.0.0 result is correct because my larger program worked under 2.0.0 and did not work under 2.1.0. I have loaded the coda package and VR bundle in each case. I appreciate any and all help/tips.

-Ed Merkle

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



------------------------------------------------------ Kevin Quinn Assistant Professor Department of Government and The Institute for Quantitative Social Science 34 Kirkland Street Harvard University Cambridge, MA 02138

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to