Description Usage Arguments Details Value Examples

Samples the lower triangular Cholesky factor of a Wishart random matrix.

1 | ```
rwishart_chol(n, nu, Sigma, epsilon = 0)
``` |

`n` |
sample size, a positive integer |

`nu` |
degrees of freedom, a number strictly greater than |

`Sigma` |
scale matrix, a positive definite real matrix |

`epsilon` |
a number involved in the algorithm only if it positive; its role is to guarantee the invertibility of the sampled matrices; see Details |

The argument `epsilon`

is a threshold whose role is to guarantee
that the algorithm samples invertible matrices.
The matrices sampled by the algorithm are theoretically invertible.
However, because of numerical precision, they are not always invertible when
`nu`

is close to `p-1`

, i.e. when `nu-p+1`

is small. In this case,
the simulations of chi-squared distributions involved in the algorithm can
generate zero values or values close to zero, yielding the non-invertibility
of the sampled matrices. These values are replaced with `epsilon`

if they are
smaller than `epsilon`

.

A numeric three-dimensional array; simulations are stacked along the third dimension (see example).

1 2 3 4 5 6 | ```
nu <- 4
p <- 3
Sigma <- diag(p)
Wsims <- rwishart_chol(10000, nu, Sigma)
dim(Wsims) # 3 3 10000
Wsims[,,1]
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.