50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

MCMCglmm (version 2.36)

rIW: Random Generation from the Conditional Inverse Wishart Distribution

Description

Samples from the inverse Wishart distribution, with the possibility of conditioning on a diagonal submatrix

Usage

rIW(V, nu, fix=NULL, n=1, CM=NULL)

Value

if n = 1 a matrix equal in dimension to V, if n>1 a matrix of dimension n x length(V)

Arguments

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

Author

Jarrod Hadfield j.hadfield@ed.ac.uk

Details

If W1 is a draw from the inverse Wishart, fix indexes the diagonal element of W1 which partitions W1 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 W1 such that

W1=[W111W112W121W122]

fix indexes the upper left corner of W122. If CM!=NULL then W122 is fixed at CM, otherwise W122 is fixed at V22. For example, if dim(V)=4 and fix=2 then W111 is a 1X1 matrix and W122 is a 3X3 matrix.

References

Korsgaard, I.R. et. al. 1999 Genetics Selection Evolution 31 (2) 177:181

See Also

rwishart, rwish

Examples

Run this code
nu<-10
V<-diag(4)
rIW(V, nu, fix=2)

Run the code above in your browser using DataLab