# generateToyData: Generate toy data for running GADAG In GADAG: A Genetic Algorithm for Learning Directed Acyclic Graphs

## Description

This function generates toy data that can be used to run GADAG: 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` ```generateToyData(n, p, edgemin = 0, 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). `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:

• `"star"` star-shaped DAG (all active edges start from node 1),

• `"bistar"` half of the edges start from node 1 and the other half from node 2,

• `"full"` full DAG (all the edges are active),

• `"path"` path-shaped DAG (all the nodes are connected by a single path),

• `"quadristar"` node 1 is connected to nodes 2 to 4, each being connected to 1/3 of the rest of the nodes,

• `"sixstar"` same as `"quadristar"`, with 6 nodes.

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

`GADAG`, `GADAG_Run`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ``` ############################################################# # 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) ```

### Example output

```Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

decompose, spectrum

The following object is masked from 'package:base':

union