Description Usage Arguments Details Value Author(s) References Examples
View source: R/select.dynsbm.R
Estimation of dynamic stockastic block models for different number of groups. Each model combines a stochastic block model (SBM) for its static part with independent Markov chains for the evolution of the nodes groups through time.
1 2 3 4 5 6 7 |
Y |
An object of class |
present |
|
Qmin |
Minimum number of groups >1. |
Qmax |
Maximum number of groups. |
edge.type |
Type of adjacency matrices. This should be (an unambiguous abbreviation of) one of |
K |
Only if |
directed |
If |
self.loop |
If |
nb.cores |
Number of cores to use, i.e. how many child processes and how many threads will be run simultaneously during the initialization and the estimation steps respectively. |
iter.max |
Maximal number of algorithm iterations. |
nstart |
Number of starting points for the iterative estimation algorithm. See the "Details" section. |
perturbation.rate |
Rate of perturbation (in [0,1], see |
fixed.param |
If |
bipartition |
|
plot |
Display a plot with the loglikelihood and the ICL criteria if |
This function deals with binary or weighted dynamic/temporal/evolving networks (with discrete or continuous edges).
The adjacency matrices must be coded with 0/1 in the binary
case,
with 0/y where y belongs to the set 1,..,K in the discrete
case
or with 0/y where y is numeric, must be positive and is supposed to fit a gaussian mixture in
the continuous
case.
Presence/absence information allows to model node's arrival or
departure, birth or death, or simply enables to specify missing data
(as absent nodes). If this information is missing (NULL), the presence/absence is deduced automatically from Y
by searching for nodes that do not participate in any edges (lines/columns of O in Y
) and declaring them as absent.
This function does not support the existence of nodes that are never present (error message in this case).
The estimation algorithm is iterative and rely on a starting point. Therefore, it is possible to start the algorithm many times with 'nstart' starting points.
The first starting point is obtained with an ad-hoc use of the kmeans
function.
The follwing starting point are obtained by perturbating the first one (see perturbation.rate
).
The greater nstart
, the more accurate the results.
To select the best number of groups, the "elbow" method consists in finding the point where the slope of the loglikelihood is decreasing (i.e. the loglikelihood is reaching a plateau).
If edge.type=="binary"
, the ICL criteria (plotted in red) has
to be used : the best number of nodes is supposed to maximize the ICL
criteria.
This function has been extended to the case of bipartite networks. In
this case, despite Y
has to be of dimension (T x N x N), it is
possible to give a bipartition of the nodes into two disjoint
sets. For statistical reasons, fixed.param
is automatically set
to TRUE
. Given the total number of groups Q between Qmin and
Qmax, there is Q/2 groups for each set of nodes (when Q is odd,
there is floor(Q/2)+1 groups for the largest set of nodes);
however, there is no guaranty that the final groups are
coherent with the bipartition, i.e. that any group is composed by
nodes of one of the two sets (if not, a warning message is generated).
Returns a list of dynsbm
objects. Each object of class dynsbm
is a list
with the following components:
transition |
The Markov chain transition |
membership |
An object of class |
beta |
An object of class |
gamma |
Only if |
mu/sigma |
Only |
loglikelihood |
Completed data log-likelihood. |
iter |
Number of used algorithm iterations. |
directed |
Specifies whether the model is build for directed networks. |
self.loop |
Specifies whether the model allows self-loops. |
Authors: Catherine Matias, Vincent Miele
Maintainer: Vincent Miele <vincent.miele@univ-lyon1.fr>
Catherine Matias and Vincent Miele, Statistical clustering of temporal networks through a dynamic stochastic block model, Journal of the Royal Statistical Society: Series B (2017) http://dx.doi.org/10.1111/rssb.12200 http://arxiv.org/abs/1506.07464
Vincent Miele and Catherine Matias, Revealing the hidden structure of dynamic ecological networks, Royal Society Open Science (2017) http://dx.doi.org/10.1098/rsos.170251 https://arxiv.org/abs/1701.01355
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data(simdataT5Q4N40binary)
## estimation for Q=1..6 groups
list.dynsbm <- select.dynsbm(simdataT5Q4N40binary,
Qmin=1, Qmax=6, edge.type="binary", nstart=1)
## Not run:
## better to use nstart>1 starting points
## but estimation can take 1-2 minutes
list.dynsbm <- select.dynsbm(simdataT5Q4N40binary,
Qmin=1, Qmax=6, edge.type="binary", nstart=25)
## End(Not run)
## selection of Q=4
dynsbm <- list.dynsbm[[4]]
## plotting intra/inter connectivity patterns
connectivity.plot(dynsbm, simdataT5Q4N40binary)
## plotting switches between groups
alluvial.plot(dynsbm)
|
--------------
Default style:
-----------
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
--------------
[1] "checking edges"
Updated styles:
$`T1-1`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-2`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-3`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-4`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-1`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-2`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-3`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-4`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-1`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-2`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-3`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-4`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-1`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-2`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-3`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-4`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T5-1`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T5-2`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T5-3`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T5-4`
$col
[1] "gray47"
$lty
[1] 0
$textcol
[1] "black"
$nodestyle
[1] "regular"
$srt
[1] "90"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-1->T2-1`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-2->T2-2`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-2->T2-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-3->T2-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-4->T2-2`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T1-4->T2-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-1->T3-1`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-2->T3-2`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-3->T3-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-3->T3-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-4->T3-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T2-4->T3-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-1->T4-1`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-1->T4-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-2->T4-2`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-3->T4-1`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-3->T4-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T3-4->T4-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-1->T5-1`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-2->T5-2`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-3->T5-3`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
$`T4-4->T5-4`
$nodestyle
[1] "regular"
$col
[1] "grey"
$srt
[1] "90"
$lty
[1] 1
$textcol
[1] "black"
$textcex
[1] 1
$edgecol
[1] "gradient"
$edgestyle
[1] "sin"
attr(,"class")
[1] "list" "riverplotStyle"
--------------
[1] "calculating sizes"
$lefts
T1-1 T1-2 T1-3 T1-4 T2-1 T2-2 T2-3 T2-4 T3-1 T3-2 T3-3 T3-4 T4-1 T4-2 T4-3 T4-4
0.00 0.00 0.00 0.00 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
T5-1 T5-2 T5-3 T5-4
0.45 0.45 0.45 0.45
$rights
T1-1 T1-2 T1-3 T1-4 T2-1 T2-2 T2-3 T2-4 T3-1 T3-2 T3-3 T3-4 T4-1 T4-2 T4-3 T4-4
0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
T5-1 T5-2 T5-3 T5-4
0.00 0.00 0.00 0.00
$sizey
T1-1 T1-2 T1-3 T1-4 T2-1 T2-2 T2-3 T2-4 T3-1 T3-2 T3-3 T3-4 T4-1 T4-2 T4-3 T4-4
0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45 0.45
T5-1 T5-2 T5-3 T5-4
0.45 0.45 0.45 0.45
[1] "calculating positions"
[1] 0.18
ID x y
T1-1 T1-1 1 1
T1-2 T1-2 1 2
T1-3 T1-3 1 3
T1-4 T1-4 1 4
T2-1 T2-1 2 1
T2-2 T2-2 2 2
T2-3 T2-3 2 3
T2-4 T2-4 2 4
T3-1 T3-1 3 1
T3-2 T3-2 3 2
T3-3 T3-3 3 3
T3-4 T3-4 3 4
T4-1 T4-1 4 1
T4-2 T4-2 4 2
T4-3 T4-3 4 3
T4-4 T4-4 4 4
T5-1 T5-1 5 1
T5-2 T5-2 5 2
T5-3 T5-3 5 3
T5-4 T5-4 5 4
[1] "done"
[1] "drawing edges"
[1] "drawing nodes"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.