Description Usage Arguments Details Value Examples
This function simulates a special case of the Stochastic Block Model (SBM).
1 2 | simulate_simple_SBM(N, p_1, D, R, p_d = NULL, p_s = NULL,
verb = FALSE)
|
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. |
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.
a named list with y
being a sparse vector of labels, and
A
a sparse adjacency matrix.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.