| Title: | Handling Missing Data in Stochastic Block Models |
|---|---|
| Description: | When a network is partially observed (here, NAs in the adjacency matrix rather than 1 or 0 due to missing information between node pairs), it is possible to account for the underlying process that generates those NAs. 'missSBM', presented in 'Barbillon, Chiquet and Tabouy' (2022) <doi:10.18637/jss.v101.i12>, adjusts the popular stochastic block model from network data sampled under various missing data conditions, as described in 'Tabouy, Barbillon and Chiquet' (2019) <doi:10.1080/01621459.2018.1562934>. |
| Authors: | Julien Chiquet [aut, cre] (ORCID: <https://orcid.org/0000-0002-3629-3429>), Pierre Barbillon [aut] (ORCID: <https://orcid.org/0000-0002-7766-7693>), Timothée Tabouy [aut], Jean-Benoist Léger [ctb] (provided C++ implementaion of K-means), François Gindraud [ctb] (provided C++ interface to NLopt), großBM team [ctb] |
| Maintainer: | Julien Chiquet <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-07-22 01:12:58 UTC |
| Source: | https://github.com/cran/missSBM |
Class for defining a block dyad sampler
networkSampling -> networkSampler -> dyadSampler -> blockDyadSampler
dfthe number of parameters of this sampling
blockDyadSampler$new()constructor for networkSampling
blockDyadSampler$new( parameters = NA, nbNodes = NA, directed = FALSE, clusters = NA )
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
clustersa vector of class memberships
blockDyadSampler$clone()The objects of this class are cloneable with this method.
blockDyadSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a block-dyad sampling
networkSampling -> networkSamplingDyads_fit -> blockDyadSampling_fit
vExpecvariational expectation of the sampling
log_lambdamatrix, term for adjusting the imputation step which depends on the type of sampling
blockDyadSampling_fit$new()constructor
blockDyadSampling_fit$new(partlyObservedNetwork, blockInit)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
blockInitn x Q matrix of initial block indicators
blockDyadSampling_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
blockDyadSampling_fit$update_parameters(nu, Z)
nuthe matrix of (uncorrected) imputation for missing entries
Zprobabilities of block memberships
blockDyadSampling_fit$clone()The objects of this class are cloneable with this method.
blockDyadSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for defining a block node sampler
networkSampling -> networkSampler -> nodeSampler -> blockNodeSampler
blockNodeSampler$new()constructor for networkSampling
blockNodeSampler$new( parameters = NA, nbNodes = NA, directed = FALSE, clusters = NA )
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
clustersa vector of class memberships
blockNodeSampler$clone()The objects of this class are cloneable with this method.
blockNodeSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a block-node sampling
networkSampling -> networkSamplingNodes_fit -> blockNodeSampling_fit
vExpecvariational expectation of the sampling
log_lambdadouble, term for adjusting the imputation step which depends on the type of sampling
blockNodeSampling_fit$new()constructor
blockNodeSampling_fit$new(partlyObservedNetwork, blockInit)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
blockInitn x Q matrix of initial block indicators
blockNodeSampling_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
blockNodeSampling_fit$update_parameters(imputedNet, Z)
imputedNetan adjacency matrix where missing values have been imputed
Zindicator of blocks
blockNodeSampling_fit$clone()The objects of this class are cloneable with this method.
blockNodeSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Extracts model coefficients from objects missSBM_fit returned by estimateMissSBM()
## S3 method for class 'missSBM_fit' coef( object, type = c("mixture", "connectivity", "covariates", "sampling"), ... )## S3 method for class 'missSBM_fit' coef( object, type = c("mixture", "connectivity", "covariates", "sampling"), ... )
object |
an R6 object with class |
type |
type of parameter that should be extracted. Either "mixture" (default), "connectivity", "covariates" or "sampling" |
... |
additional parameters for S3 compatibility. Not used |
A vector or matrix of coefficients extracted from the missSBM_fit model.
Class for fitting a dyad sampling with covariates
networkSampling -> networkSamplingDyads_fit -> covarDyadSampling_fit
vExpecvariational expectation of the sampling
covarDyadSampling_fit$new()constructor
covarDyadSampling_fit$new(partialNet, ...)
partialNeta object with class partlyObservedNetwork representing the observed data with possibly missing entries
...used for compatibility
covarDyadSampling_fit$clone()The objects of this class are cloneable with this method.
covarDyadSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a node-centered sampling with covariate
networkSampling -> networkSamplingNodes_fit -> covarNodeSampling_fit
vExpecvariational expectation of the sampling
covarNodeSampling_fit$new()constructor
covarNodeSampling_fit$new(partlyObservedNetwork, ...)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
...used for compatibility
covarNodeSampling_fit$clone()The objects of this class are cloneable with this method.
covarNodeSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for defining a degree sampler
networkSampling -> networkSampler -> nodeSampler -> degreeSampler
degreeSampler$new()constructor for networkSampling
degreeSampler$new(parameters = NA, degrees = NA, directed = FALSE)
parametersthe vector of parameters associated to the sampling at play
degreesvector of nodes' degrees
directedlogical, directed network of not
degreeSampler$clone()The objects of this class are cloneable with this method.
degreeSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a degree sampling
networkSampling -> networkSamplingNodes_fit -> degreeSampling_fit
vExpecvariational expectation of the sampling
degreeSampling_fit$new()constructor
degreeSampling_fit$new(partlyObservedNetwork, blockInit, connectInit)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
blockInitn x Q matrix of initial block indicators
connectInitQ x Q matrix of initial block probabilities of connection
degreeSampling_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
degreeSampling_fit$update_parameters(imputedNet, ...)
imputedNetan adjacency matrix where missing values have been imputed
...used for compatibility
degreeSampling_fit$update_imputation()a method to update the imputation of the missing entries.
degreeSampling_fit$update_imputation(PI, ...)
PIthe matrix of inter/intra class probability of connection
...use for compatibility
degreeSampling_fit$clone()The objects of this class are cloneable with this method.
degreeSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for defining a double-standard sampler
networkSampling -> networkSampler -> dyadSampler -> doubleStandardSampler
doubleStandardSampler$new()constructor for networkSampling
doubleStandardSampler$new(parameters = NA, adjMatrix = NA, directed = FALSE)
parametersthe vector of parameters associated to the sampling at play
adjMatrixmatrix of adjacency
directedlogical, directed network of not
doubleStandardSampler$clone()The objects of this class are cloneable with this method.
doubleStandardSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a double-standard sampling
networkSampling -> networkSamplingDyads_fit -> doubleStandardSampling_fit
vExpecvariational expectation of the sampling
doubleStandardSampling_fit$new()constructor
doubleStandardSampling_fit$new(partlyObservedNetwork, ...)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
...used for compatibility
doubleStandardSampling_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
doubleStandardSampling_fit$update_parameters(nu, ...)
nuan adjacency matrix with imputed values (only)
...use for compatibility
doubleStandardSampling_fit$update_imputation()a method to update the imputation of the missing entries.
doubleStandardSampling_fit$update_imputation(nu)
nuthe matrix of (uncorrected) imputation for missing entries
doubleStandardSampling_fit$clone()The objects of this class are cloneable with this method.
doubleStandardSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Virtual class for all dyad-centered samplers
networkSampling -> networkSampler -> dyadSampler
dyadSampler$new()constructor for networkSampling
dyadSampler$new(type = NA, parameters = NA, nbNodes = NA, directed = FALSE)
typecharacter for the type of sampling. must be in ("dyad", "covar-dyad", "node", "covar-node", "block-node", "block-dyad", "double-standard", "degree")
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
dyadSampler$clone()The objects of this class are cloneable with this method.
dyadSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a dyad sampling
networkSampling -> networkSamplingDyads_fit -> dyadSampling_fit
vExpecvariational expectation of the sampling
dyadSampling_fit$new()constructor
dyadSampling_fit$new(partlyObservedNetwork, ...)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
...used for compatibility
dyadSampling_fit$clone()The objects of this class are cloneable with this method.
dyadSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
A dataset containing the weighted PPI network centered around the ESR1 (ER) protein
er_networker_network
A sparse symmetric matrix with 741 rows and 741 columns ESR1
data("er_network") class(er_network)data("er_network") class(er_network)
Variational EM inference of Stochastic Block Models indexed by block number from a partially observed network.
estimateMissSBM( adjacencyMatrix, vBlocks, sampling, covariates = list(), control = missSBM_param() )estimateMissSBM( adjacencyMatrix, vBlocks, sampling, covariates = list(), control = missSBM_param() )
adjacencyMatrix |
The N x N adjacency matrix of the network data. If |
vBlocks |
The vector of number of blocks considered in the collection. |
sampling |
The model used to described the process that originates the missing data: MAR designs ("dyad", "node","covar-dyad","covar-node","snowball") and MNAR designs ("double-standard", "block-dyad", "block-node" , "degree") are available. See details. |
covariates |
An optional list with M entries (the M covariates). If the covariates are node-centered, each entry of |
control |
a list-like structure for controlling advanced features, with default generated
by |
Internal functions use future_lapply, so set your plan to 'multisession' or
'multicore' to use several cores/workers.
The different sampling designs are split into two families in which we find dyad-centered and node-centered samplings. See doi:10.1080/01621459.2018.1562934 for a complete description.
Missing at Random (MAR)
dyad parameter = p = Prob(Dyad(i,j) is observed)
node parameter = p = Prob(Node i is observed)
covar-dyad": parameter = beta in R^M, such that Prob(Dyad (i,j) is observed) = logistic(parameter' covarArray (i,j, .))
covar-node": parameter = nu in R^M such that Prob(Node i is observed) = logistic(parameter' covarMatrix (i,)
snowball": parameter = number of waves with Prob(Node i is observed in the 1st wave)
Missing Not At Random (MNAR)
double-standard parameter = (p0,p1) with p0 = Prob(Dyad (i,j) is observed | the dyad is equal to 0), p1 = Prob(Dyad (i,j) is observed | the dyad is equal to 1)
block-node parameter = c(p(1),...,p(Q)) and p(q) = Prob(Node i is observed | node i is in cluster q)
block-dyad parameter = c(p(1,1),...,p(Q,Q)) and p(q,l) = Prob(Edge (i,j) is observed | node i is in cluster q and node j is in cluster l)
Returns an R6 object with class missSBM_collection.
observeNetwork, missSBM_collection, missSBM_fit and missSBM_param.
## SBM parameters N <- 100 # number of nodes Q <- 3 # number of clusters pi <- rep(1,Q)/Q # block proportion theta <- list(mean = diag(.45,Q) + .05 ) # connectivity matrix ## Sampling parameters samplingParameters <- .75 # the sampling rate sampling <- "dyad" # the sampling design ## generate a undirected binary SBM with no covariate sbm <- sbm::sampleSimpleSBM(N, pi, theta) ## Uncomment to set parallel computing with future ## future::plan("multicore", workers = 2) ## Sample some dyads data + Infer SBM with missing data collection <- observeNetwork(sbm$networkData, sampling, samplingParameters) %>% estimateMissSBM(vBlocks = 1:4, sampling = sampling) plot(collection, "monitoring") plot(collection, "icl") collection$ICL coef(collection$bestModel$fittedSBM, "connectivity") myModel <- collection$bestModel plot(myModel, "expected") plot(myModel, "imputed") plot(myModel, "meso") coef(myModel, "sampling") coef(myModel, "connectivity") predict(myModel)[1:5, 1:5]## SBM parameters N <- 100 # number of nodes Q <- 3 # number of clusters pi <- rep(1,Q)/Q # block proportion theta <- list(mean = diag(.45,Q) + .05 ) # connectivity matrix ## Sampling parameters samplingParameters <- .75 # the sampling rate sampling <- "dyad" # the sampling design ## generate a undirected binary SBM with no covariate sbm <- sbm::sampleSimpleSBM(N, pi, theta) ## Uncomment to set parallel computing with future ## future::plan("multicore", workers = 2) ## Sample some dyads data + Infer SBM with missing data collection <- observeNetwork(sbm$networkData, sampling, samplingParameters) %>% estimateMissSBM(vBlocks = 1:4, sampling = sampling) plot(collection, "monitoring") plot(collection, "icl") collection$ICL coef(collection$bestModel$fittedSBM, "connectivity") myModel <- collection$bestModel plot(myModel, "expected") plot(myModel, "imputed") plot(myModel, "meso") coef(myModel, "sampling") coef(myModel, "connectivity") predict(myModel)[1:5, 1:5]
missSBM_fit, return by estimateMissSBM()
Extract model fitted values from object missSBM_fit, return by estimateMissSBM()
## S3 method for class 'missSBM_fit' fitted(object, ...)## S3 method for class 'missSBM_fit' fitted(object, ...)
object |
an R6 object with class |
... |
additional parameters for S3 compatibility. |
A matrix of estimated probabilities of connection
French Political Blogosphere network dataset consists of a single day snapshot of over 200 political blogs automatically extracted the 14 October 2006 and manually classified by the "Observatoire Présidentielle" project. Originally part of the 'mixer' package
frenchblog2007frenchblog2007
An igraph object with 196 nodes. The vertex attribute "party" provides a possible clustering of the nodes.
https://www.meltwater.com/en/suite/consumer-intelligence?utm_source=direct&utm_medium=linkfluence
data(frenchblog2007) igraph::V(frenchblog2007)$party igraph::plot.igraph(frenchblog2007, vertex.color = factor(igraph::V(frenchblog2007)$party), vertex.label = NA )data(frenchblog2007) igraph::V(frenchblog2007)$party igraph::plot.igraph(frenchblog2007, vertex.color = factor(igraph::V(frenchblog2007)$party), vertex.label = NA )
Compute l1-similarity between two vectors
l1_similarity(x, y)l1_similarity(x, y)
x |
a vector |
y |
a vector |
a vector equal to -abs(x-y)
l1_similarity(1:5, 5:1)l1_similarity(1:5, 5:1)
The function estimateMissSBM() fits a collection of SBM with missing data for
a varying number of block. These models with class missSBM_fit are stored in an instance
of an object with class missSBM_collection, described here.
Fields are accessed via active binding and cannot be changed by the user.
This class comes with a set of R6 methods, some of them being useful for the user and exported
as S3 methods. See the documentation for show() and print()
modelsa list of models
ICLthe vector of Integrated Classification Criterion (ICL) associated to the models in the collection (the smaller, the better)
bestModelthe best model according to the ICL, restricted to models without
collapsed classes when at least one such model is available (see $degenerate)
vBlocksa vector with the number of blocks
occupiedBlocksa vector with the number of classes actually occupied in each model
(see missSBM_fit's occupiedBlocks)
degeneratelogical vector, TRUE for models with collapsed classes
(occupiedBlocks < vBlocks, see missSBM_fit's repair())
optimizationSettingsthe control list used by estimate()/polish()/explore() when
not overridden per call (set at construction by estimateMissSBM())
optimizationStatusa data.frame summarizing the optimization process for all models
missSBM_collection$new()constructor for networkSampling
missSBM_collection$new(partlyObservedNet, sampling, clusterInit, control)
partlyObservedNetAn object with class partlyObservedNetwork.
samplingThe sampling design for the modelling of missing data: MAR designs ("dyad", "node") and MNAR designs ("double-standard", "block-dyad", "block-node" ,"degree")
clusterInitInitial clustering: a list of vectors, each with size ncol(adjacencyMatrix).
controla list of parameters controlling advanced features. Only 'trace' and 'useCov' are relevant here. See estimateMissSBM() for details.
missSBM_collection$estimate()method to launch the estimation of the collection of models
missSBM_collection$estimate(control = NULL)
controloptional list of parameters overriding the collection's stored control (set at construction by estimateMissSBM(), see its details for the full list). Default NULL uses the stored control as-is.
missSBM_collection$estimate_chain()alternative to estimate(): fits each model in increasing order of
number of blocks, initializing vBlocks[k] by splitting (see missSBM_fit's
split()/candidates_split()) the already-converged model at
vBlocks[k-1] instead of an independent, cold spectral clustering. Meant to reduce
VEM component collapse at higher numbers of blocks (see $degenerate), at the cost
of being sequential in the number of blocks (unlike estimate(), which fits every
model in parallel) – can be slower in wall-clock time with many workers available.
Falls back to this slot's own cold-started clustering (built at construction, same as
estimate() would use) whenever nothing is splittable along the chain.
missSBM_collection$estimate_chain(control = NULL)
controloptional list of parameters overriding the collection's stored control (set at construction by estimateMissSBM(), see its details for the full list). Default NULL uses the stored control as-is.
missSBM_collection$polish()method to node-swap-polish every model in the collection (see
missSBM_fit's polish()); fixes individually misclassified nodes at each
model's own number of blocks, unlike explore() which searches across blocks.
missSBM_collection$polish(control = NULL)
controloptional list of parameters overriding the collection's stored control (set at construction by estimateMissSBM(), see its details for the full list). Default NULL uses the stored control as-is.
missSBM_collection$explore()method for performing exploration of the ICL (split/merge search across
numbers of blocks, see missSBM_fit's candidates_split()/candidates_merge()).
Uses the collection's stored control by default; iterates lets the caller override
it for this call only, without altering the stored control – handy to alternate
explore()/polish() calls without having to reconstruct a full control list
each time. iterates <= 0 is a no-op.
missSBM_collection$explore(control = NULL, iterates = NULL, direction = "both")
controloptional list of parameters overriding the collection's stored control (set at construction by estimateMissSBM(), see its details for the full list). Default NULL uses the stored control as-is.
iteratesoptional integer overriding control$iterates for this call only.
directioncharacter ("forward", "backward", "both" or "none") controlling which directions are searched. Default "both".
missSBM_collection$plot()plot method for missSBM_collection
missSBM_collection$plot(type = c("icl", "elbo", "monitoring"))
typethe type specifies the field to plot, either "icl", "elbo" or "monitoring". Default is "icl"
missSBM_collection$show()show method for missSBM_collection
missSBM_collection$show()
missSBM_collection$print()User friendly print method
missSBM_collection$print()
missSBM_collection$clone()The objects of this class are cloneable with this method.
missSBM_collection$clone(deep = FALSE)
deepWhether to make a deep clone.
## Uncomment to set parallel computing with future ## future::plan("multicore", workers = 2) ## Sample 75% of dyads in French political Blogosphere's network data adjacencyMatrix <- missSBM::frenchblog2007 %>% igraph::delete.vertices(1:100) %>% igraph::as_adjacency_matrix() %>% missSBM::observeNetwork(sampling = "dyad", parameters = 0.75) collection <- estimateMissSBM(adjacencyMatrix, 1:5, sampling = "dyad") class(collection)## Uncomment to set parallel computing with future ## future::plan("multicore", workers = 2) ## Sample 75% of dyads in French political Blogosphere's network data adjacencyMatrix <- missSBM::frenchblog2007 %>% igraph::delete.vertices(1:100) %>% igraph::as_adjacency_matrix() %>% missSBM::observeNetwork(sampling = "dyad", parameters = 0.75) collection <- estimateMissSBM(adjacencyMatrix, 1:5, sampling = "dyad") class(collection)
The function estimateMissSBM() fits a collection of SBM for varying number of block.
Each fitted SBM is an instance of an R6 object with class missSBM_fit, described here.
Fields are accessed via active binding and cannot be changed by the user.
This class comes with a set of R6 methods, some of them being useful for the user and exported
as S3 methods. See the documentation for show(), print(), fitted(), predict(), plot().
fittedSBMthe fitted SBM with class SimpleSBM_fit_noCov, SimpleSBM_fit_withCov or
SimpleSBM_fit_MNAR inheriting from class sbm::SimpleSBM_fit
fittedSamplingthe fitted sampling, inheriting from class networkSampling and corresponding fits
imputedNetworkThe network data as a matrix with NAs values imputed with the current model
monitoringa list carrying information about the optimization process
occupiedBlocksthe number of classes actually occupied by at least one node; can be
less than fittedSBM$nbBlocks for an over-specified fit whose VEM has collapsed one
or more classes (see repair())
degenerateTRUE if occupiedBlocks < fittedSBM$nbBlocks
entropyImputedthe entropy of the distribution of the imputed dyads
entropythe entropy due to the distribution of the imputed dyads and of the clustering
vExpecdouble: variational expectation of the complete log-likelihood
penaltydouble, value of the penalty term in ICL
loglikdouble: approximation of the log-likelihood (variational lower bound) reached
ICLdouble: value of the integrated classification log-likelihood
missSBM_fit$new()constructor for networkSampling
missSBM_fit$new(partlyObservedNet, netSampling, clusterInit, useCov = TRUE)
partlyObservedNetAn object with class partlyObservedNetwork.
netSamplingThe sampling design for the modelling of missing data: MAR designs ("dyad", "node") and MNAR designs ("double-standard", "block-dyad", "block-node" ,"degree")
clusterInitInitial clustering: a vector with size ncol(adjacencyMatrix), providing a user-defined clustering. The number of blocks is deduced from the number of levels in with clusterInit.
useCovlogical. If covariates are present in partlyObservedNet, should they be used for the inference or of the network sampling design, or just for the SBM inference? default is TRUE.
missSBM_fit$doVEM()a method to perform inference of the current missSBM fit with variational EM
missSBM_fit$doVEM( control = list(threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = TRUE) )
controla list of VEM control parameters (see estimateMissSBM())
missSBM_fit$split()clone of the current fit after splitting cluster index in two, via a
spectral bipartition of the sub-network it induces. Builds but does not fit the
candidate (see candidates_split()).
missSBM_fit$split(index, in_place = FALSE, base_net = NULL)
indexindex (integer) of the cluster to split
in_placereplace self's own fit (TRUE) or return a new object
(FALSE, the default)?
base_netoptional precomputed network to bipartition (as built internally at the
top of this method); lets candidates_split() avoid recomputing it once per
candidate.
a new missSBM_fit with one more block, or NULL if index cannot
be split (its induced sub-network has zero variance)
missSBM_fit$candidates_split()generate and cheaply trial-fit candidates obtained by splitting each
splittable cluster in two (see split()). A cluster is splittable if it has at
least 4 members and non-zero variance in its induced sub-network.
missSBM_fit$candidates_split( control = list(threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = TRUE), trial_niter = 2 )
controla list of VEM control parameters (see estimateMissSBM()); maxIter is overridden by trial_niter
trial_niternumber of VEM iterations used for the trial fits. Default is 2.
a list of trial-fitted missSBM_fit candidates (one per splittable cluster)
missSBM_fit$merge()clone of the current fit after merging clusters indices[1] and
indices[2] into one. Builds but does not fit the candidate (see
candidates_merge()).
missSBM_fit$merge(indices, in_place = FALSE)
indicesindices (couple of integers) of the clusters to merge
in_placereplace self's own fit (TRUE) or return a new object
(FALSE, the default)?
a new missSBM_fit with one fewer block
missSBM_fit$candidates_merge()generate and cheaply trial-fit candidates obtained by merging pairs of
clusters (see merge()). Beyond max_candidates pairs (quadratic in the
number of blocks), only the most similar-connectivity pairs are tried.
missSBM_fit$candidates_merge( control = list(threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = TRUE), max_candidates = 30, trial_niter = 2 )
controla list of VEM control parameters (see estimateMissSBM()); maxIter is overridden by trial_niter
max_candidatescap on the number of pairs tried. Default is 30.
trial_niternumber of VEM iterations used for the trial fits. Default is 2.
a list of trial-fitted missSBM_fit candidates
missSBM_fit$repair()recovers a degenerate fit (fewer occupied classes than its structural
nbBlocks, e.g. after a VEM component collapse) by filling the empty classes (see
repair_empty_classes()) and refitting the full VEM. Mutates self in place;
a no-op if the fit is not degenerate.
missSBM_fit$repair( control = list(threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = TRUE) )
controla list of VEM control parameters (see estimateMissSBM())
invisibly, self
missSBM_fit$polish()discrete node-swap polishing (Kernighan-Lin / greedy-ICL style): after VEM
convergence, tau is near-hard and its fixed point cannot relocate a single
misclassified node (only split()/merge() fix group-level mistakes). Each
sweep computes, for every node, the closed-form complete-data log-likelihood gain of
moving it to its best alternative class (theta/pi held fixed), applies the improving,
non-class-emptying moves, then runs a full VEM to resettle. Stops as soon as a sweep
fails to improve the ICL, mutates self in place, and never leaves the ICL worse
than before the call.
missSBM_fit$polish( control = list(threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = TRUE), max_sweeps = 10 )
controla list of VEM control parameters (see estimateMissSBM())
max_sweepsmaximum number of swap sweeps. Default is 10.
invisibly, self
missSBM_fit$show()show method for missSBM_fit
missSBM_fit$show()
missSBM_fit$print()User friendly print method
missSBM_fit$print()
missSBM_fit$clone()The objects of this class are cloneable with this method.
missSBM_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
## Sample 75% of dyads in French political Blogosphere's network data adjMatrix <- missSBM::frenchblog2007 %>% igraph::as_adjacency_matrix(sparse = FALSE) %>% missSBM::observeNetwork(sampling = "dyad", parameters = 0.75) collection <- estimateMissSBM(adjMatrix, 3:5, sampling = "dyad") my_missSBM_fit <- collection$bestModel class(my_missSBM_fit) plot(my_missSBM_fit, "imputed")## Sample 75% of dyads in French political Blogosphere's network data adjMatrix <- missSBM::frenchblog2007 %>% igraph::as_adjacency_matrix(sparse = FALSE) %>% missSBM::observeNetwork(sampling = "dyad", parameters = 0.75) collection <- estimateMissSBM(adjMatrix, 3:5, sampling = "dyad") my_missSBM_fit <- collection$bestModel class(my_missSBM_fit) plot(my_missSBM_fit, "imputed")
Helper to define the list of parameters that controls estimateMissSBM(). All arguments have defaults.
missSBM_param( threshold = 0.01, maxIter = 50, fixPointIter = 3, imputation = c("median", "average", "zero"), similarity = l1_similarity, useCov = TRUE, clusterInit = NULL, polish = TRUE, iterates = 1, maxMergeCandidates = 30, stopOnDegenerate = TRUE, maxConsecutiveDegenerate = 2, warmChain = FALSE, trace = TRUE )missSBM_param( threshold = 0.01, maxIter = 50, fixPointIter = 3, imputation = c("median", "average", "zero"), similarity = l1_similarity, useCov = TRUE, clusterInit = NULL, polish = TRUE, iterates = 1, maxMergeCandidates = 30, stopOnDegenerate = TRUE, maxConsecutiveDegenerate = 2, warmChain = FALSE, trace = TRUE )
threshold |
V-EM algorithm stops when an optimization step changes the objective function or the parameters by less than threshold. Default is 1e-2. |
maxIter |
V-EM algorithm stops when the number of iteration exceeds maxIter. Default is 50. |
fixPointIter |
number of fix-point iterations in the V-E step. Default is 3. |
imputation |
character, the imputation strategy used to build the initial clustering (see
|
similarity |
an R x R -> R function to compute similarities between node covariates.
Default is |
useCov |
logical. If |
clusterInit |
initial clustering: |
polish |
logical, should each model be node-swap-polished (see missSBM_fit's
|
iterates |
integer, the number of forward/backward exploration passes searching for a
better number of blocks by splitting/merging clusters (unlike |
maxMergeCandidates |
integer, caps the number of cluster-pair merge candidates tried during backward exploration (quadratic in the number of blocks otherwise). Beyond this cap, only the pairs with the most similar fitted connectivity profiles are tried, since merging two blocks with very different connectivity is rarely competitive anyway. Default is 30. |
stopOnDegenerate |
logical. A requested number of blocks can be higher than what the
network actually supports: VEM then collapses one or more classes (see missSBM_fit's
|
maxConsecutiveDegenerate |
integer, the run length that triggers |
warmChain |
logical (work in progress). If |
trace |
logical for verbosity. Default is TRUE. |
a list of parameters configuring the fit, with class missSBM_param.
my_control <- missSBM_param(iterates = 2, polish = FALSE) my_control$iteratesmy_control <- missSBM_param(iterates = 2, polish = FALSE) my_control$iterates
This class is use to define a sampling model for a network. Inherits from 'networkSampling'. Owns a rSampling method which takes an adjacency matrix as an input and send back an object with class partlyObservedNetwork.
networkSampling -> networkSampler
samplingMatrixa matrix of logical indicating observed entries
networkSampler$new()constructor for networkSampling
networkSampler$new(type = NA, parameters = NA, nbNodes = NA, directed = FALSE)
typecharacter for the type of sampling. must be in ("dyad", "covar-dyad", "node", "covar-node", "block-node", "block-dyad", "double-standard", "degree")
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
networkSampler$rSamplingMatrix()a method for drawing a sampling matrix according to the current sampling design
networkSampler$rSamplingMatrix()
networkSampler$clone()The objects of this class are cloneable with this method.
networkSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
this virtual class is the mother of all subtypes of networkSampling (either sampler or fit) It is used to define a sampling model for a network. It has a rSampling method which takes an adjacency matrix as an input and send back an object with class partlyObservedNetwork.
typea character for the type of sampling
parametersthe vector of parameters associated with the sampling at play
dfthe number of entries in the vector of parameters
networkSampling$new()constructor for networkSampling
networkSampling$new(type = NA, parameters = NA)
typecharacter for the type of sampling. must be in ("dyad", "covar-dyad", "node", "covar-node", "block-node", "block-dyad", "double-standard", "degree")
parametersthe vector of parameters associated to the sampling at play
networkSampling$show()show method
networkSampling$show( type = paste0(private$name, "-model for network sampling\n") )
typecharacter used to specify the type of sampling
networkSampling$print()User friendly print method
networkSampling$print()
networkSampling$clone()The objects of this class are cloneable with this method.
networkSampling$clone(deep = FALSE)
deepWhether to make a deep clone.
Virtual class used to define a family of networkSamplingDyads_fit
networkSampling -> networkSamplingDyads_fit
penaltydouble, value of the penalty term in ICL
log_lambdadouble, term for adjusting the imputation step which depends on the type of sampling
networkSamplingDyads_fit$new()constructor for networkSampling_fit
networkSamplingDyads_fit$new(partlyObservedNetwork, name)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
namea character for the name of sampling to fit on the partlyObservedNetwork
networkSamplingDyads_fit$show()show method
networkSamplingDyads_fit$show()
networkSamplingDyads_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
networkSamplingDyads_fit$update_parameters(...)
...use for compatibility
networkSamplingDyads_fit$update_imputation()a method to update the imputation of the missing entries.
networkSamplingDyads_fit$update_imputation(nu)
nuthe matrix of (uncorrected) imputation for missing entries
networkSamplingDyads_fit$clone()The objects of this class are cloneable with this method.
networkSamplingDyads_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Virtual class used to define a family of networkSamplingNodes_fit
networkSampling -> networkSamplingNodes_fit
penaltydouble, value of the penalty term in ICL
log_lambdadouble, term for adjusting the imputation step which depends on the type of sampling
networkSamplingNodes_fit$new()constructor
networkSamplingNodes_fit$new(partlyObservedNetwork, name)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
namea character for the name of sampling to fit on the partlyObservedNetwork
networkSamplingNodes_fit$show()show method
networkSamplingNodes_fit$show()
networkSamplingNodes_fit$update_parameters()a method to update the estimation of the parameters. By default, nothing to do (corresponds to MAR sampling)
networkSamplingNodes_fit$update_parameters(...)
...use for compatibility
networkSamplingNodes_fit$update_imputation()a method to update the imputation of the missing entries.
networkSamplingNodes_fit$update_imputation(nu)
nuthe matrix of (uncorrected) imputation for missing entries
networkSamplingNodes_fit$clone()The objects of this class are cloneable with this method.
networkSamplingNodes_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
Virtual class for all node-centered samplers
networkSampling -> networkSampler -> nodeSampler
nodeSampler$clone()The objects of this class are cloneable with this method.
nodeSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for fitting a node sampling
networkSampling -> networkSamplingNodes_fit -> nodeSampling_fit
vExpecvariational expectation of the sampling
nodeSampling_fit$new()constructor
nodeSampling_fit$new(partlyObservedNetwork, ...)
partlyObservedNetworka object with class partlyObservedNetwork representing the observed data with possibly missing entries
...used for compatibility
nodeSampling_fit$clone()The objects of this class are cloneable with this method.
nodeSampling_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
This function draws observations in an adjacency matrix according to a given network sampling design.
observeNetwork( adjacencyMatrix, sampling, parameters, clusters = NULL, covariates = list(), similarity = l1_similarity, intercept = 0 )observeNetwork( adjacencyMatrix, sampling, parameters, clusters = NULL, covariates = list(), similarity = l1_similarity, intercept = 0 )
adjacencyMatrix |
The N x N adjacency matrix of the network to sample. The diagonal is expected to be NA (no self-loops); any other pre-existing NA entry is treated as an absent edge (coded 0) before sampling is applied on top of it, with a warning. |
sampling |
The sampling design used to observe the adjacency matrix, see details. |
parameters |
The sampling parameters (adapted to each sampling, see details). |
clusters |
An optional clustering membership vector of the nodes. Only necessary for block samplings. |
covariates |
An optional list with M entries (the M covariates). If the covariates are node-centered,
each entry of |
similarity |
An optional function to compute similarities between node covariates. Default is
|
intercept |
An optional intercept term to be added in case of the presence of covariates. Default is 0. |
Internal functions use future_lapply, so set your plan to 'multisession' or
'multicore' to use several cores/workers.
The different sampling designs are split into two families in which we find dyad-centered and node-centered samplings. See doi:10.1080/01621459.2018.1562934 for a complete description.
Missing at Random (MAR)
dyad parameter = p = Prob(Dyad(i,j) is observed)
node parameter = p = Prob(Node i is observed)
covar-dyad": parameter = beta in R^M, such that Prob(Dyad (i,j) is observed) = logistic(parameter' covarArray (i,j, .))
covar-node": parameter = nu in R^M such that Prob(Node i is observed) = logistic(parameter' covarMatrix (i,)
snowball": parameter = number of waves with Prob(Node i is observed in the 1st wave)
Missing Not At Random (MNAR)
double-standard parameter = (p0,p1) with p0 = Prob(Dyad (i,j) is observed | the dyad is equal to 0), p1 = Prob(Dyad (i,j) is observed | the dyad is equal to 1)
block-node parameter = c(p(1),...,p(Q)) and p(q) = Prob(Node i is observed | node i is in cluster q)
block-dyad parameter = c(p(1,1),...,p(Q,Q)) and p(q,l) = Prob(Edge (i,j) is observed | node i is in cluster q and node j is in cluster l)
an adjacency matrix with the same dimension as the input, yet with additional NAs.
## SBM parameters N <- 300 # number of nodes Q <- 3 # number of clusters pi <- rep(1,Q)/Q # block proportion theta <- list(mean = diag(.45,Q) + .05 ) # connectivity matrix ## simulate an unidrected binary SBM without covariate sbm <- sbm::sampleSimpleSBM(N, pi, theta) ## Sample network data # some sampling design and their associated parameters sampling_parameters <- list( "dyad" = .3, "node" = .3, "double-standard" = c(0.4, 0.8), "block-node" = c(.3, .8, .5), "block-dyad" = theta$mean, "degree" = c(.01, .01), "snowball" = c(2,.1) ) observed_networks <- list() for (sampling in names(sampling_parameters)) { observed_networks[[sampling]] <- missSBM::observeNetwork( adjacencyMatrix = sbm$networkData, sampling = sampling, parameters = sampling_parameters[[sampling]], clusters = sbm$memberships ) }## SBM parameters N <- 300 # number of nodes Q <- 3 # number of clusters pi <- rep(1,Q)/Q # block proportion theta <- list(mean = diag(.45,Q) + .05 ) # connectivity matrix ## simulate an unidrected binary SBM without covariate sbm <- sbm::sampleSimpleSBM(N, pi, theta) ## Sample network data # some sampling design and their associated parameters sampling_parameters <- list( "dyad" = .3, "node" = .3, "double-standard" = c(0.4, 0.8), "block-node" = c(.3, .8, .5), "block-dyad" = theta$mean, "degree" = c(.01, .01), "snowball" = c(2,.1) ) observed_networks <- list() for (sampling in names(sampling_parameters)) { observed_networks[[sampling]] <- missSBM::observeNetwork( adjacencyMatrix = sbm$networkData, sampling = sampling, parameters = sampling_parameters[[sampling]], clusters = sbm$memberships ) }
This class is not exported to the user
samplingRateThe percentage of observed dyads
nbNodesThe number of nodes
nbDyadsThe number of dyads
is_directedlogical indicating if the network is directed or not
networkDataThe adjacency matrix of the network
covarArraythe array of covariates
covarMatrixthe matrix of covariates
samplingMatrixmatrix of observed and non-observed edges
samplingMatrixBarmatrix of observed and non-observed edges
observedNodesa vector of observed and non-observed nodes (observed means at least one non NA value)
partlyObservedNetwork$new()constructor
partlyObservedNetwork$new( adjacencyMatrix, covariates = list(), similarity = l1_similarity )
adjacencyMatrixThe adjacency matrix of the network
covariatesA list with M entries (the M covariates), each of whom being either a size-N vector or N x N matrix.
similarityAn R x R -> R function to compute similarities between node covariates. Default is l1_similarity, that is, -abs(x-y).
partlyObservedNetwork$clustering()method to cluster network data with missing value
partlyObservedNetwork$clustering( vBlocks, imputation = ifelse(is.null(private$phi), "median", "average") )
vBlocksThe vector of number of blocks considered in the collection.
imputationcharacter indicating the type of imputation among "median", "average"
partlyObservedNetwork$imputation()basic imputation from existing clustering
partlyObservedNetwork$imputation(type = c("median", "average", "zero"))
typea character, the type of imputation. Either "median" or "average"
partlyObservedNetwork$clone()The objects of this class are cloneable with this method.
partlyObservedNetwork$clone(deep = FALSE)
deepWhether to make a deep clone.
missSBM_fit
Plot function for the various fields of a missSBM_fit: the fitted
SBM (network or connectivity), and a plot monitoring the optimization.
## S3 method for class 'missSBM_fit' plot( x, type = c("imputed", "expected", "meso", "monitoring"), dimLabels = list(row = "node", col = "node"), ... )## S3 method for class 'missSBM_fit' plot( x, type = c("imputed", "expected", "meso", "monitoring"), dimLabels = list(row = "node", col = "node"), ... )
x |
an object with class |
type |
the type specifies the field to plot, either "imputed", "expected", "meso", or "monitoring" |
dimLabels |
: a list of two characters specifying the labels of the nodes. Default to |
... |
additional parameters for S3 compatibility. Not used |
a ggplot object
missSBM_fit (i.e. network with imputed missing dyads)Prediction of a missSBM_fit (i.e. network with imputed missing dyads)
## S3 method for class 'missSBM_fit' predict(object, ...)## S3 method for class 'missSBM_fit' predict(object, ...)
object |
an R6 object with class |
... |
additional parameters for S3 compatibility. |
an adjacency matrix between pairs of nodes. Missing dyads are imputed with their expected values, i.e. by there estimated probabilities of connection under the missing SBM.
Class for defining a simple dyad sampler
networkSampling -> networkSampler -> dyadSampler -> simpleDyadSampler
simpleDyadSampler$new()constructor for networkSampling
simpleDyadSampler$new( parameters = NA, nbNodes = NA, directed = FALSE, covarArray = NULL, intercept = 0 )
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
covarArrayan array of covariates used
interceptdouble, intercept term used to compute the probability of sampling in the presence of covariates. Default 0.
simpleDyadSampler$clone()The objects of this class are cloneable with this method.
simpleDyadSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for defining a simple node sampler
networkSampling -> networkSampler -> nodeSampler -> simpleNodeSampler
simpleNodeSampler$new()constructor for networkSampling
simpleNodeSampler$new( parameters = NA, nbNodes = NA, directed = FALSE, covarMatrix = NULL, intercept = 0 )
parametersthe vector of parameters associated to the sampling at play
nbNodesnumber of nodes in the network
directedlogical, directed network of not
covarMatrixa matrix of covariates used
interceptdouble, intercept term used to compute the probability of sampling in the presence of covariates. Default 0.
simpleNodeSampler$clone()The objects of this class are cloneable with this method.
simpleNodeSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
It is not designed to be called directly by the user; see the concrete variants
SimpleSBM_fit_noCov, SimpleSBM_fit_withCov and SimpleSBM_fit_MNAR.
sbm::SBM -> sbm::SimpleSBM -> SimpleSBM_fit
typethe type of SBM (distribution of edges values, network type, presence of covariates)
penaltydouble, value of the penalty term in ICL
entropydouble, value of the entropy due to the clustering distribution
loglikdouble: approximation of the log-likelihood (variational lower bound) reached
ICLdouble: value of the integrated classification log-likelihood
SimpleSBM_fit$new()constructor for simpleSBM_fit for missSBM purpose
SimpleSBM_fit$new(networkData, clusterInit, covarList = list())
networkDataa structure to store network under missing data condition: either a matrix possibly with NA, or a missSBM:::partlyObservedNetwork
clusterInitInitial clustering: a vector with size ncol(adjacencyMatrix), providing a user-defined clustering with nbBlocks levels.
covarListAn optional list with M entries (the M covariates).
SimpleSBM_fit$doVEM()method to perform estimation via variational EM
SimpleSBM_fit$doVEM( threshold = 0.01, maxIter = 100, fixPointIter = 3, trace = FALSE )
thresholdstop when an optimization step changes the objective function by less than threshold. Default is 1e-4.
maxIterV-EM algorithm stops when the number of iteration exceeds maxIter. Default is 10
fixPointIternumber of fix-point iterations in the Variational E step. Default is 5.
tracelogical for verbosity. Default is FALSE.
SimpleSBM_fit$reorder()permute group labels by order of decreasing probability
SimpleSBM_fit$reorder()
SimpleSBM_fit$get_state()a lightweight snapshot of the mutable VEM state (as opposed to clone(),
which duplicates the whole object, including the – possibly large – network data)
SimpleSBM_fit$get_state()
SimpleSBM_fit$set_state()restore a state previously returned by get_state()
SimpleSBM_fit$set_state(state)
statea state, as returned by get_state()
SimpleSBM_fit$clone()The objects of this class are cloneable with this method.
SimpleSBM_fit$clone(deep = FALSE)
deepWhether to make a deep clone.
It is not designed to be called directly by the user.
sbm::SBM -> sbm::SimpleSBM -> SimpleSBM_fit -> SimpleSBM_fit_noCov -> SimpleSBM_MNAR_noCov
vExpecdouble: variational approximation of the expectation complete log-likelihood
SimpleSBM_MNAR_noCov$new()constructor for simpleSBM_fit for missSBM purpose
SimpleSBM_MNAR_noCov$new(networkData, clusterInit)
networkDataa structure to store network under missing data condition: either a matrix possibly with NA, or a missSBM:::partlyObservedNetwork
clusterInitInitial clustering: a vector with size ncol(adjacencyMatrix), providing a user-defined clustering with nbBlocks levels.
SimpleSBM_MNAR_noCov$update_parameters()update parameters estimation (M-step)
SimpleSBM_MNAR_noCov$update_parameters(nu = NULL)
nucurrently imputed values
SimpleSBM_MNAR_noCov$update_blocks()update variational estimation of blocks (VE-step)
SimpleSBM_MNAR_noCov$update_blocks(log_lambda = 0)
log_lambdaadditional term sampling dependent used to de-bias estimation of tau
SimpleSBM_MNAR_noCov$polish_log_tau()for each node, the complete-data log-likelihood it would contribute to
each class if hard-assigned there (theta/pi held fixed), used to decide node-swap
moves in missSBM_fit$polish(). Unlike update_blocks()'s tau update (which
combines the observed- and imputed-part E-steps as-is), this subtracts one copy of
log(pi): both E-step calls add it, so summing them double-counts it relative to
vExpec's convention – verified numerically to matter (see git history).
SimpleSBM_MNAR_noCov$polish_log_tau(log_lambda = 0)
log_lambdaadditional sampling-design-dependent term, added as-is
an N x Q matrix
SimpleSBM_MNAR_noCov$clone()The objects of this class are cloneable with this method.
SimpleSBM_MNAR_noCov$clone(deep = FALSE)
deepWhether to make a deep clone.
It is not designed to be called directly by the user.
sbm::SBM -> sbm::SimpleSBM -> SimpleSBM_fit -> SimpleSBM_fit_noCov
imputationthe matrix of imputed values
vExpecdouble: variational approximation of the expectation complete log-likelihood
vExpec_correcteddouble: variational approximation of the expectation complete log-likelihood with correction to be comparable with MNAR criteria
SimpleSBM_fit_noCov$update_parameters()update parameters estimation (M-step)
SimpleSBM_fit_noCov$update_parameters(...)
...additional arguments, only required for MNAR cases
SimpleSBM_fit_noCov$update_blocks()update variational estimation of blocks (VE-step)
SimpleSBM_fit_noCov$update_blocks(...)
...additional arguments, only required for MNAR cases
SimpleSBM_fit_noCov$polish_log_tau()for each node, the complete-data log-likelihood it would contribute to
each class if hard-assigned there (theta/pi held fixed), used to decide node-swap
moves in missSBM_fit$polish().
SimpleSBM_fit_noCov$polish_log_tau(log_lambda = 0)
log_lambdaadditional sampling-design-dependent term, added as-is
an N x Q matrix
SimpleSBM_fit_noCov$clone()The objects of this class are cloneable with this method.
SimpleSBM_fit_noCov$clone(deep = FALSE)
deepWhether to make a deep clone.
It is not designed to be called directly by the user.
sbm::SBM -> sbm::SimpleSBM -> SimpleSBM_fit -> SimpleSBM_fit_withCov
imputationthe matrix of imputed values
vExpecdouble: variational approximation of the expectation complete log-likelihood
vExpec_correcteddouble: variational approximation of the expectation complete log-likelihood with correction to be comparable with MNAR criteria
SimpleSBM_fit_withCov$update_parameters()update parameters estimation (M-step) via Newton-Raphson: the M-step objective is a weighted logistic regression (concave), so Newton converges in a handful of iterations – no external optimizer is required.
SimpleSBM_fit_withCov$update_parameters(...)
...use for compatibility
SimpleSBM_fit_withCov$update_blocks()update variational estimation of blocks (VE-step)
SimpleSBM_fit_withCov$update_blocks(...)
...use for compatibility
SimpleSBM_fit_withCov$polish_log_tau()for each node, the complete-data log-likelihood it would contribute to
each class if hard-assigned there (theta/beta/pi held fixed), used to decide node-swap
moves in missSBM_fit$polish().
SimpleSBM_fit_withCov$polish_log_tau(log_lambda = 0)
log_lambdaadditional sampling-design-dependent term, added as-is
an N x Q matrix
SimpleSBM_fit_withCov$clone()The objects of this class are cloneable with this method.
SimpleSBM_fit_withCov$clone(deep = FALSE)
deepWhether to make a deep clone.
Class for defining a snowball sampler
networkSampling -> networkSampler -> nodeSampler -> snowballSampler
snowballSampler$new()constructor for networkSampling
snowballSampler$new(parameters = NA, adjacencyMatrix = NA, directed = FALSE)
parametersthe vector of parameters associated to the sampling at play
adjacencyMatrixthe adjacency matrix of the network
directedlogical, directed network of not
snowballSampler$clone()The objects of this class are cloneable with this method.
snowballSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
missSBM_fit
Summary method for a missSBM_fit
## S3 method for class 'missSBM_fit' summary(object, ...)## S3 method for class 'missSBM_fit' summary(object, ...)
object |
an R6 object with class |
... |
additional parameters for S3 compatibility. |
a basic printing output
This dataset contains two networks where the nodes are countries and an
edge in network "belligerent" means that the two countries have been at
least once at war between years 1816 to 2007 while an edge in network "alliance"
means that the two countries have had a formal alliance between years 1816 to 2012.
The network belligerent have less nodes since countries which have not been at
war are not considered.
warwar
A list with 2 two igraph objects, alliance and belligerent.
Each graph have three attributes: 'name' (the country name), 'power' (a score related to military power: the higher, the better) and
'trade' (a score related to the trade effort between pairs of countries).
networks were extracted from https://correlatesofwar.org/
Sarkees, Meredith Reid and Frank Wayman (2010). Resort to War: 1816 - 2007. Washington DC: CQ Press.
Gibler, Douglas M. 2009. International military alliances, 1648-2008. CQ Press
data(war) class(war$belligerent) igraph::gorder(war$alliance) igraph::gorder(war$belligerent) igraph::edges(war$alliance) igraph::get.graph.attribute(war$alliance)data(war) class(war$belligerent) igraph::gorder(war$alliance) igraph::gorder(war$belligerent) igraph::edges(war$alliance) igraph::get.graph.attribute(war$alliance)