R: Sample a covariance Matrix from the Posterior Inverse Wishart...

cvPost {RxODE} | R Documentation

## Sample a covariance Matrix from the Posterior Inverse Wishart distribution.

### Description

Note this Inverse wishart rescaled to match the original scale of the covariance matrix.

### Usage

    cvPost(nu, omega, n = 1L, omegaIsChol = FALSE, returnChol = FALSE)

### Arguments

`nu` | Degrees of Freedom (Number of Observations) for covariance matrix simulation.
`omega` | Estimate of Covariance matrix.
`n` | Number of Matrices to sample. By default this is 1.
`omegaIsChol` | is an indicator of if the omega matrix is in the Cholesky decomposition.
`returnChol` | Return the Cholesky decomposition of the covariance matrix sample.

### Details

If your covariance matrix is a 1x1 matrix, this uses an scaled inverse chi-squared which is equivalent to the Inverse Wishart distribution in the uni-directional case.

### Value

a matrix (n=1) or a list of matrices (n > 1)

### Author(s)

Matthew L.Fidler & Wenping Wang

### Examples

    ## Sample a single covariance.
    draw1 <- cvPost(3, matrix(c(1,.3,.3,1),2,2))

    ## Sample 3 covariances
    set.seed(42)
    draw3 <- cvPost(3, matrix(c(1,.3,.3,1),2,2), n=3)

    ## Sample 3 covariances, but return the cholesky decomposition
    set.seed(42)
    draw3c <- cvPost(3, matrix(c(1,.3,.3,1),2,2), n=3, returnChol=TRUE)

[Package RxODE version 0.9.1-9 Index]