simulate_simple_SBM: Simulate simplified Stochastic Block Model

Description Usage Arguments Details Value Examples

Description

This function simulates a special case of the Stochastic Block Model (SBM).

Usage

1
2
simulate_simple_SBM(N, p_1, D, R, p_d = NULL, p_s = NULL,
  verb = FALSE)

Arguments

N

number of nodes.

p_1

probability of a node being labelled as 1.

D

expected density of the network, between 0 and 1.

R

assortativeness parameter (non-negative). See Details.

p_d

(alternative parameterization) probability of an edge existing between nodes with different labels (see Details).

p_s

(alternative parameterization) probability of an edge existing between nodes with equal labels (see Details).

verb

prints minor details about the simulation.

Details

In this simplified version, there are only 2 distinct labels. Nodes with different labels have an edge between them with probability p_d, while the probability is p_s if they have matching labels. In the language of the SBM, the matrix of edge probabilities is completely specified by one number associated with the diagonal (p_s), and another for the off-diagonal elements (p_d).

In spite of the above, the preferred way of specifying the model is by the tuple (N, p_1, D, R), where D is the expected density of the network (between 0 and 1), and R (non-negative) controls its assortativeness: for R>1, links are more common between pairs of nodes with equal labels (assortative network). For R<1, the opposite is true (disassortative network).

The use can choose between supplying (N, p_1, D, R) or (N, p_1, p_s, p_d), but they cannot be mixed.

Note that this implementation takes advantage of the structure of the SBM to efficiently sample sparse random objects. One consequence of this is that the elements of y are ordered, starting with all the positive nodes, and then all the non-positives. The same happens with A, which is partitioned into according blocks. If this is an issue, the user can always permute the elements of y and A in a random but consistent fashion.

Value

a named list with y being a sparse vector of labels, and A a sparse adjacency matrix.

Examples

1
2
3
4
5
6
7
8
9
res = simulate_simple_SBM(N=25L, p_1=0.2, D = 0.1, R = 0.25)
str(res)
res2 = simulate_simple_SBM(N=25L, p_1=0.2, p_s = 0.001, p_d = 0.25)
str(res2)
## Not run: 
    # invalid combination of parameterizations
    simulate_simple_SBM(N=25L, p_1=0.2, D = 0.001, p_d = 0.25)

## End(Not run)

miguelbiron/threepRop documentation built on May 29, 2019, 9:31 a.m.