# rNetwork: Simulation of (clustered) Gaussian networks In simone: Statistical Inference for MOdular NEtworks (SIMoNe)

## Description

Simulates a network with various structures.

## Usage

 ```1 2 3 4 5 6``` ```rNetwork(p, pi, alpha = c(1), directed = FALSE, name = "a network", signed = TRUE) ```

## Arguments

 `p` the number of nodes of the simulated network. `pi` a matrix of cluster connectivity (see details). `alpha` a vector of cluster proportions. `directed` a logical indicating the directedness of the network. `name` a character string indicating the name of the network. `signed` a logical indicating whether partial correlations should be signed or all kept positive.

## Details

Matrix `pi` should be a square matrix of the same size as vector `alpha`. When the network is not directed, `pi` should be symmetric. When the graph is directed, entry π_ql corresponds to edges heading from class q to class l.

Entries of `pi` can be either integers or real numbers. If they are integers, they are considered as the exact number of edges required from one class to another. Otherwise, they are considered as connectivity probabilities between classes. They should therefore sum up to at most 1. If they do not sum up to one excatly, the remaining value is considered as the probability for a node to belong to the dust class (connected to no other node).

## Value

Returns an object of class `simone.network`, that is, a list comprising

 `A` the p x p adjacency matrix of the network, filled with 0 and 1's, which is symmetric if `directed` is `FALSE`. `Theta` a p x p matrix of parameters of the associated Gaussian model, which depends on the directedness of the network: if directed, `Theta` contains the parameters of a VAR(1) model; if undirected, `Theta` is the concentration matrix (inverse of the covariance matrix) of a Gaussian vector `directed` a logicial indicating the directedness of the network. `clusters` a size-p factor indicating the node class. The number of levels is determined by the number of columns of the matrix of connectivity `pi`: the levels are labeled 1,...,Q where Q is the number of clusters. `name` a character string containing the name of the network.

## Author(s)

J. Chiquet, C. Charbonnier

## See Also

`coNetwork`, `plot.simone.network`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```## generate an Erdos-Renyi network with 50 nodes and Pr of edges = 0.1 plot(rNetwork(p = 50, pi = 0.1, name = "an Erdos-Renyi network")) ## generate an network with 15 nodes and 25 randomly selected edges plot(rNetwork(p = 15, pi = 25, name = "a 25 edges network")) ## generate an undirected network with an affiliation structure PI <- matrix(c(15,2,2,50),2,2) alpha <- c(1/3,2/3) plot(rNetwork(p = 20, pi = PI, alpha = alpha, name = "Affiliation, fixed num of edges")) ## generate a directed network with hubs PI <- t(matrix(c(0.2,0.1,0.4,0,0.05,0.15,0,0.4,rep(0,8)),4,4)) alpha <- c(1/20,1/20,9/20,9/20) plot(rNetwork(p = 55, pi = PI, alpha = alpha, directed = TRUE, name = "Hubs structured network")) ```

### Example output    ```Loading required package: blockmodels
Loading required package: Rcpp
Loading required package: parallel
Loading required package: digest

----------------------------------------------------------------------

'simone' package version 1.0-3
SIMoNe page (http://julien.cremeriefamily.info/simone.html)

----------------------------------------------------------------------
Note that versions >= 1.0-0 are not compatible with versions < 1.0.0.
----------------------------------------------------------------------
```

simone documentation built on May 2, 2019, 2:37 a.m.