cov_cons {genscore} | R Documentation |
Random generator of inverse covariance matrices.
Description
Random generator of inverse covariance matrices.
Usage
cov_cons(mode, p, seed = NULL, spars = 1, eig = 0.1, subgraphs = 1)
Arguments
mode |
A string, see details. |
p |
A positive integer >= 2, the dimension. |
seed |
A number, the seed for the generator. Ignored if |
spars |
A number, see details. Ignored if |
eig |
A positive number, the minimum eigenvalue of the returned matrix. Default to 0.1. |
subgraphs |
A positive integer, the number of subgraphs for the |
Details
The function generates an inverse covariance matrix according to the mode
argument as follows. The diagonal entries of the matrix are set to the same value such that the minimum eigenvalue of the returned matrix is equal to eig
.
- "random"
Takes the
Q
matrix from theQR
decomposition of ap
byp
random matrix with independentNormal(0,1)
entries, and calculatesQ' diag(ev) Q
. Randomly zeros out its upper triangular entries using independent uniform Bernoulli(spars
) variables, and then symmetrizes the matrix using the upper triangular part.- "sub"
Constructs a block diagonal matrix with
subgraphs
disconnected subgraphs with equal number of nodes. In each subgraph, takes each entry independently fromUniform(0.5,1)
, and randomly zeros out its upper triangular entries using independent uniform Bernoulli(spars
) variables, and finally symmetrizes the matrix using the upper triangular part. The construction from Section 4.2 of Lin et al. (2016).- "er"
Constructs an Erd\H{o}s-R\'enyi game with probability
spars
, and sets the edges to independentUniform(0.5,1)
variables, and finally symmetrizes the matrix using the lower triangular entries.- "band"
Constructs a banded matrix so that the
(i,j)
-th matrix is nonzero if and only if|i-j|<=spars
, and is equal to1-|i-j|/(spars+1)
ifi!=j
.- "chain"
A chain graph, where the
(i,j)
-th matrix is nonzero if and only if|i-j|<=1
, and is equal to 0.5 if|i-j|==1
. A special case of the"band"
construction withspars
equal to 1.
Value
A p
by p
inverse covariance matrix. See details.
References
Lin L, Drton M, Shojaie A (2016). “Estimation of high-dimensional graphical models using regularized score matching.” Electron. J. Stat., 10(1), 806–854.
Examples
p <- 100
K1 <- cov_cons("random", p, seed = 1, spars = 0.05, eig = 0.1)
K2 <- cov_cons("sub", p, seed = 2, spars = 0.5, eig = 0.1, subgraphs=10)
K3 <- cov_cons("er", p, seed = 3, spars = 0.05, eig = 0.1)
K4 <- cov_cons("band", p, spars = 2, eig = 0.1)
K5 <- cov_cons("chain", p, eig = 0.1)