Description Usage Arguments Details Value References Examples
Sample correlation matrices, possibly with a zero pattern in its Cholesky decomposition constrained by an acyclic digraph.
1 2 3 |
N |
Number of samples. |
p |
Matrix dimension. Ignored if |
d |
Number in |
dag |
An igraph acyclic digraph specifying the zero pattern in the upper Cholesky factor of the sampled matrices. Nodes must be in ancestral order, with the first one having no parents. |
... |
Additional parameters for |
Function chol_mh()
uses the method described in
Córdoba et al. (2018) and implemented in mh_u()
, based
on a Metropolis-Hastings algorithm over the upper Cholesky
factorization.
The entries in the upper Cholesky factor are sampled i.i.d. by
function chol_iid()
, following Kalisch and Buhlmann (2007).
A three-dimensional array of length p x p x N
.
Córdoba I., Varando G., Bielza C., Larrañaga P. A fast Metropolis-Hastings method for generating random correlation matrices. Lecture Notes in Computer Science (IDEAL 2018), vol 11314, pp. 117-124, 2018.
Kalisch, M., Buhlmann, P. Estimating high-dimensional directed acyclic graphs with the PC-algorithm, Journal of Machine Learning Research, 8:613-636, 2007.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Cholesky sampling via Metropolis-Hastings
# Generate a full matrix (default behaviour)
chol_mh()
# Generate a matrix with a percentage of zeros
chol_mh(d = 0.5)
# Generate a random acyclic digraph structure
dag <- rgraph(p = 3, d = 0.5, dag = TRUE)
igraph::print.igraph(dag)
# Generate a matrix complying with the predefined zero pattern
chol_mh(dag = dag)
## Cholesky sampling via i.i.d. Cholesky factor
# Generate a full matrix (default behaviour)
chol_iid()
# Generate a matrix with a percentage of zeros
chol_iid(d = 0.5)
# Generate a matrix complying with the predefined zero pattern
igraph::print.igraph(dag)
chol_iid(dag = dag)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.