SBM_sampler {missSBM} | R Documentation |
The function simulate
produces an instance of an object with class SBM_sampler
.
SBM_sampler
An object of class R6ClassGenerator
of length 24.
All fields of this class are only accessible for reading. This class comes with a set of methods, some of them being useful for the user (see examples)
R6 methods:$rBlocks(), $rAdjancencyMatrix()
S3 methodsprint(), plot()
nNodes
The number of nodes
nBlocks
The number of blocks
nCovariates
The number of covariates
nDyads
The number of possible dyad in the network (depends on the direction)
direction
A character indicating if the network is directed or undirected
hasCovariates
a boolean indicating if the model has covariates
mixtureParam
the vector of mixture parameters
connectParam
the matrix of connectivity: inter/intra probabilities of connection when the network does not have covariates, or a logit scaled version of it.
covarParam
the vector of parameters associated with the covariates
covarArray
the array of covariates
The function simulate
.
## SBM parameters directed <- FALSE N <- 300 # number of nodes Q <- 3 # number of clusters alpha <- rep(1,Q)/Q # mixture parameter pi <- diag(.45,Q) + .05 # connectivity matrix gamma <- log(pi/(1-pi)) # logit transform fo the model with covariates M <- 2 # two Gaussian covariates covarMatrix <- matrix(rnorm(N*M,mean = 0, sd = 1), N, M) covarParam <- rnorm(M, -1, 1) ## draw a SBM without covariates through simulateSBM sbm <- missSBM::simulate(N, alpha, pi, directed) ## equivalent construction from the SBM_sampler class itslef sbm_s <- SBM_sampler$new(directed, N, alpha, pi) sbm_s$rBlocks() # draw some blocks sbm_s$rAdjMatrix() # draw some edges