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 NULL or mode == "band" or mode == "chain".

spars

A number, see details. Ignored if mode == "chain". Default to 1.

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 "sub" mode. Note that p must be divisible by subgraphs.

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

"sub"

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 Lin et al. (2016).

"er"

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.

"band"

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.

"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 with spars 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)

[Package genscore version 1.0.2.2 Index]