cov_cons | R Documentation |
Random generator of inverse covariance matrices.
cov_cons(mode, p, seed = NULL, spars = 1, eig = 0.1, subgraphs = 1)
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 |
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
.
Takes the Q
matrix from the QR
decomposition of a p
by p
random matrix with independent Normal(0,1)
entries, and calculates Q' 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.
Constructs a block diagonal matrix with subgraphs
disconnected subgraphs with equal number of nodes. In each subgraph, takes each entry independently from Uniform(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 \insertCitelin16;textualgenscore.
Constructs an Erd\H{o}s-R\'enyi game with probability spars
, and sets the edges to independent Uniform(0.5,1)
variables, and finally symmetrizes the matrix using the lower triangular entries.
Constructs a banded matrix so that the (i,j)
-th matrix is nonzero if and only if |i-j|<=spars
, and is equal to 1-|i-j|/(spars+1)
if i!=j
.
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 with spars
equal to 1.
A p
by p
inverse covariance matrix. See details.
lin16genscore
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.