generateToyData: Generate toy data for running GADAG2

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/generateToyData.R

Description

This function generates toy data that can be used to run GADAG2: the adjacency matrix of a DAG with p nodes and the design matrix with n observations of the distribution of the p nodes.

Usage

1
2
generateToyData(n, p, edgemin = 0, Cov = diag(p), type = "star",
  seed = 42)

Arguments

n

Number of samples in the design matrix.

p

Number of nodes of the DAG.

edgemin

Minimal value for the non-null edges of the DAG (between 0 and 1).

Cov

(optional) Covariance matrix for the noise variables (identity matrix by default)

type

Form of the DAG. It can be chosen between 7 alternatives: "star", "bistar", "full", "path", "quadristar", "sixstar" (see details below).

seed

Fix the seed.

Details

One of the following seven alternatives can be chosen for the DAG form:

Value

A list containing the design nxp matrix X (with samples in rows and variables in columns) and the adjacency matrix G associated to the DAG with p nodes.

Author(s)

Magali Champion, Victor Picheny and Matthieu Vignes.

See Also

GADAG2, GADAG2_Run.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 #############################################################
 # Generating toy data
 #############################################################
 toy_data <- generateToyData(n=100, p=10)

 # toy_data is a list of two matrices corresponding to a "star"
 # DAG (node 1 activates all other nodes):
 # - toy_data$X is a 100x10 design matrix
 # - toy_data$G is the 10x10 adjacency matrix (ground trough)

 ## Not run: 
 # generate another type of data: a DAG with 100 nodes in a path form
 toy_data <- generateToyData(n=100, p=100,type="path")
 
## End(Not run)

 ## Not run: 
 # set the minimal edge value to 1
 toy_data <- generateToyData(n=100, p=10, edgemin=1) # all edges are set to 1
 
## End(Not run)

 ## Not run: 
 # non-independent noises
 A <- matrix(runif(10^2)*2-1, ncol=10)
 Sigma <- t(A) %*% A
 toy_data <- generateToyData(n=100, p=10, edgemin=1, Cov = Sigma)
 
## End(Not run)

magalichampion/GADAG documentation built on May 21, 2019, 11:04 a.m.