| rIW {MCMCglmm} | R Documentation |
Samples from the inverse Wishart distribution, with the possibility of conditioning on a diagonal submatrix
rIW(V, nu, fix=NULL, n=1, CM=NULL)
V |
Expected (co)varaince matrix as nu tends to infinity |
nu |
degrees of freedom |
fix |
optional integer indexing the partition to be conditioned on |
n |
integer: number of samples to be drawn |
CM |
matrix: optional matrix to condition on. If not given, and fix!=NULL, V_22 is conditioned on |
If solve(W) is a draw from the inverse Wishart, fix indexes the diagonal element of solve(W) which partitions solve(W) into 4 submatrices. fix indexes the upper left corner of the lower
diagonal matrix and it is this matrix that is conditioned on.
For example partioning solve(W) such that
solve(W) = solve(W)_11 solve(W)_12
solve(W)_21 solve(W)_22
fix indexes the upper left corner of solve(W)_22. If CM!=NULL then solve(W)_22 is fixed at CM, otherwise solve(W)_22 is fixed at V_22. For example, if dim(V)=4 and fix=2 then solve(W)_11 is a 1X1 matrix and solve(W)_22 is a 3X3 matrix.
if n = 1 a matrix equal in dimension to V, if n>1 a
matrix of dimension n x length(V)
In versions of MCMCglmm >1.10 the arguments to rIW have changed so that they are more intuitive in the context of MCMCglmm. Following the notation of Wikipedia (http://en.wikipedia.org/wiki/Inverse-Wishart_distribution) the inverse scale matrix Psi = V*nu. In earlier versions of MCMCglmm (<1.11) Psi=solve(V). Although the old parameterisation is consistent with the riwish function in MCMCpack and the rwishart function in bayesm it is inconsistent with the prior definition for MCMCglmm. The following pieces of code are sampling from the same distributions:
riwish(nu, nu*V) | from MCMCpack |
rwishart(nu, solve(nu*V))$IW | from bayesm |
rIW(nu, solve(nu*V)) | from MCMCglmm <1.11 |
rIW(V, nu) | from MCMCglmm >=1.11 |
Jarrod Hadfield j.hadfield@ed.ac.uk
Korsgaard, I.R. et. al. 1999 Genetics Selection Evolution 31 (2) 177:181
nu<-10 V<-diag(4) rIW(V, nu, fix=2)