dag: Simulation of correlation matrices

Description Usage Arguments Details Value References Examples

Description

Sample correlation matrices, possibly with a zero pattern in its Cholesky decomposition constrained by an acyclic digraph.

Usage

1
2
3
chol_mh(N = 1, p = 3, d = 1, dag = NULL, ...)

chol_iid(N = 1, p = 3, d = 1, dag = NULL)

Arguments

N

Number of samples.

p

Matrix dimension. Ignored if dag is provided.

d

Number in [0,1], the proportion of non-zero entries in the Cholesky factor of the sampled matrices. Ignored if dag is provided.

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 mh_u().

Details

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).

Value

A three-dimensional array of length p x p x N.

References

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.

Examples

 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)

gmat documentation built on Aug. 30, 2020, 9:07 a.m.

Related to dag in gmat...