# NOT RUN {
## SBM parameters
N <- 150 # 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 <- .5 # the sampling rate
sampling <- "dyad" # the sampling design
## generate a undirected binary SBM with no covariate
sbm <- sbm::sampleSimpleSBM(N, pi, theta)
## Sample some dyads data + Infer SBM with missing data
collection <-
observeNetwork(sbm$netMatrix, sampling, samplingParameters) %>%
estimateMissSBM(vBlocks = 1:5, sampling = sampling)
collection$ICL
coef(collection$bestModel$fittedSBM, "connectivity")
myModel <- collection$bestModel
plot(myModel, "network")
coef(myModel, "sampling")
coef(myModel, "connectivity")
predict(myModel)[1:5, 1:5]
fitted(myModel)[1:5, 1:5]
# }
Run the code above in your browser using DataLab