generate.Sigma: Generate covariance matrix

Description Usage Arguments Value Examples

View source: R/oneStepSim.R

Description

This function generates a matrix with block-wise customized structure.

Usage

1
generate.Sigma(m.gene, block.size, rho, dd=NULL, str.type="interchangeable")

Arguments

m.gene

number of genes in the covariance matrix.

block.size

vector of sizes (i.e. number of genes) for each block. Size can not be 0, at least 1.

rho

vector of correlation coefficients (i.e. edge strength) in each block. The vector should have the same length as block.size. Positive correlations are suggested; use with caution for negative correlations.

dd

diagnal entries of the weight matrix. It should have length equal to m.gene. If NULL, all 1's will be assigned.

str.type

types of block structure. Options: "interchangeable" (default) assumes an interchangeable correlation in the block; "decaying" is an AR(1) model; "star" gives a star-shape structure. It can also be a vector of mixed types, but should have the same length as rho.

Value

A list with the following components:

Sigma

a covariance matrix with customized structure.

true.str

true structure in generated Sigma. A matrix with 0 (no structure) and 1 (an edge).

Examples

1
2
3
4
5
6
## a correlation matrix with three designed blocks
Sigma.str1 <- generate.Sigma(m.gene=35, block.size=c(5,10,15), rho=c(0.9,0.8,0.7),
                             str.type=c("interchangeable","decaying","star"))
                             
## no structure, i.e. an identity matrix
Sigma.str2 <- generate.Sigma(m.gene=10, block.size=1, rho=0)

yunzhang813/simDeNet-R-Package documentation built on Dec. 24, 2019, 3:02 p.m.