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

View source: R/camel.tiger.generator.R

Implements the data generation from multivariate normal distributions with different graph structures, including `"random"`

, `"hub"`

, `"cluster"`

, `"band"`

, and `"scale-free"`

.

1 2 |

`n` |
The number of observations (sample size). The default value is |

`d` |
The number of variables (dimension). The default value is |

`graph` |
The graph structure with 5 options: |

`v` |
The off-diagonal elements of the precision matrix, controlling the magnitude of partial correlations with |

`u` |
A positive number being added to the diagonal elements of the precision matrix, to control the magnitude of partial correlations. The default value is |

`g` |
For |

`prob` |
For |

`seed` |
Set seed for data generation. The default value is 1. |

`vis` |
Visualize the adjacency matrix of the true graph structure, the graph pattern, the covariance matrix and the empirical covariance matrix. The default value is |

`verbose` |
If |

Given the adjacency matrix `theta`

, the graph patterns are generated as below:

(I) `"random"`

: Each pair of off-diagonal elements are randomly set `theta[i,j]=theta[j,i]=1`

for `i!=j`

with probability `prob`

, and `0`

other wise. It results in about `d*(d-1)*prob/2`

edges in the graph.

(II)`"hub"`

:The row/columns are evenly partitioned into `g`

disjoint groups. Each group is associated with a "center" row `i`

in that group. Each pair of off-diagonal elements are set `theta[i,j]=theta[j,i]=1`

for `i!=j`

if `j`

also belongs to the same group as `i`

and `0`

otherwise. It results in `d - g`

edges in the graph.

(III)`"cluster"`

:The row/columns are evenly partitioned into `g`

disjoint groups. Each pair of off-diagonal elements are set `theta[i,j]=theta[j,i]=1`

for `i!=j`

with the probability `prob`

if both `i`

and `j`

belong to the same group, and `0`

other wise. It results in about `g*(d/g)*(d/g-1)*prob/2`

edges in the graph.

(IV)`"band"`

: The off-diagonal elements are set to be `theta[i,j]=1`

if `1<=|i-j|<=g`

and `0`

other wise. It results in `(2d-1-g)*g/2`

edges in the graph.

(V) `"scale-free"`

: The graph is generated using B-A algorithm. The initial graph has two connected nodes and each new node is connected to only one node in the existing graph with the probability proportional to the degree of the each node in the existing graph. It results in `d`

edges in the graph.

The adjacency matrix `theta`

has all diagonal elements equal to `0`

. To obtain a positive definite covariance matrix, the smallest eigenvalue of `theta*v`

(denoted by `e`

) is computed. Then we set the covariance matrix equal to `cov2cor(solve(theta*v+(|e|+0.1+u)*I))`

to generate multivariate normal data.

An object with S3 class "sim" is returned:

`data` |
The |

`sigma` |
The covariance matrix for the generated data |

`omega` |
The precision matrix for the generated data |

`sigmahat` |
The empirical covariance matrix for the generated data |

`theta` |
The adjacency matrix of true graph structure (in sparse matrix representation) for the generated data |

Xingguo Li, Tuo Zhao and Han Liu

Maintainer: Xingguo Li <xingguo.leo@gmail.com>

`camel`

and `camel-package`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## band graph with bandwidth 3
L = camel.tiger.generator(graph = "band", g = 3)
plot(L)
## random sparse graph
L = camel.tiger.generator(vis = TRUE)
## random dense graph
L = camel.tiger.generator(prob = 0.5, vis = TRUE)
## hub graph with 6 hubs
L = camel.tiger.generator(graph = "hub", g = 6, vis = TRUE)
## cluster graph with 8 clusters
L = camel.tiger.generator(graph = "cluster", g = 8, vis = TRUE)
## scale-free graphs
L = camel.tiger.generator(graph="scale-free", vis = TRUE)
``` |

```
Loading required package: lattice
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
Loading required package: MASS
Loading required package: Matrix
Generating data from the multivariate normal distribution with the band graph structure....done.
Generating data from the multivariate normal distribution with the random graph structure....done.
Generating data from the multivariate normal distribution with the random graph structure....done.
Generating data from the multivariate normal distribution with the hub graph structure....done.
Generating data from the multivariate normal distribution with the cluster graph structure....done.
Generating data from the multivariate normal distribution with the scale-free graph structure....done.
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.