genER: Generate data using the Erdos and Renyi (ER) model

Description Usage Arguments Details Value Examples

View source: R/genER.R

Description

Given the number of vertices, the probability that any two vertices connect, and the sample size, generate the true graph structure and the sample data.

Usage

1
genER(p, pE, n, effS = NULL)

Arguments

p

number of vertices

pE

probability that two vertices will connect

n

sample size for data generation

effS

the effect size, must be a single number - - default is NULL which generates random coefficients for each covariate from a Uniform(0,1) distribution.

Details

The true graph structure is generated such that the probability of having an edge for any pair of vertices is p_E = d_0/p, where d_0 is average number of edges per node. Then, all graphs with p vertices and d edges have probability of p_E^d(1-p_E)^{\choose(d, 2) -d} to be generated. After we generate the adjacency matrix A, the sample data are simulated from the multivariate normal distribution with mean 0 and covariance

(I - B)^{-1}(I-B^T)^{-1}

where B = the effect size \times the lower triangular matrix of A.

Value

A list with the following components:

A

adjacency matrix of the simulated graph

X

simulated sample data

G

simulated graph as a graphNEL object

Examples

1
genER(10, 0.1, 20, 0.5)

yliu433/scZINB documentation built on Nov. 30, 2020, 9:07 p.m.