# sampleSimpleSBM: Sampling of Simple SBMs In GrossSBM/sbm: Stochastic Blockmodels

## Description

This function samples a simple Stochastic Block Models, with various model for the distribution of the edges: Bernoulli, Poisson, or Gaussian models, and possibly with covariates

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10``` ```sampleSimpleSBM( nbNodes, blockProp, connectParam, model = "bernoulli", directed = FALSE, dimLabels = c(node = "nodeName"), covariates = list(), covariatesParam = numeric(0) ) ```

## Arguments

 `nbNodes` number of nodes in the network `blockProp` parameters for block proportions `connectParam` list of parameters for connectivity with a matrix of means 'mean' and an optional matrix of variances 'var', the sizes of which must match `blockProp` length `model` character describing the model for the relation between nodes (`'bernoulli'`, `'poisson'`, `'gaussian'`, ...). Default is `'bernoulli'`. `directed` logical, directed network or not. Default is `FALSE`. `dimLabels` an optional list of labels for each dimension (in row, in column) `covariates` a list of matrices with same dimension as mat describing covariates at the edge level. No covariate per Default. `covariatesParam` optional vector of covariates effect. A zero length numeric vector by default.

## Value

an object with class `SimpleSBM`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48``` ```### ======================================= ### SIMPLE BINARY SBM (Bernoulli model) ## Graph parameters nbNodes <- 90 blockProp <- c(.5, .25, .25) # group proportions means <- diag(.4, 3) + 0.05 # connectivity matrix: affiliation network # In Bernoulli SBM, parameters is a list with a # matrix of means 'mean' which are probabilities of connection connectParam <- list(mean = means) ## Graph Sampling mySampler <- sampleSimpleSBM(nbNodes, blockProp, connectParam, model = 'bernoulli') plot(mySampler) plot(mySampler) plot(mySampler,type='meso') hist(mySampler\$networkData) ### ======================================= ### SIMPLE POISSON SBM ## Graph parameters nbNodes <- 90 blockProp <- c(.5, .25, .25) # group proportions means <- diag(15., 3) + 5 # connectivity matrix: affiliation network # In Poisson SBM, parameters is a list with # a matrix of means 'mean' which are a mean integer value taken by edges connectParam <- list(mean = means) ## Graph Sampling mySampler <- sampleSimpleSBM(nbNodes, blockProp, list(mean = means), model = "poisson") plot(mySampler) plot(mySampler,type='meso') hist(mySampler\$networkData) ### ======================================= ### SIMPLE GAUSSIAN SBM ## Graph parameters nbNodes <- 90 blockProp <- c(.5, .25, .25) # group proportions means <- diag(15., 3) + 5 # connectivity matrix: affiliation network # In Gaussian SBM, parameters is a list with # a matrix of means 'mean' and a matrix of variances 'var' connectParam <- list(mean = means, var = 2) ## Graph Sampling mySampler <- sampleSimpleSBM(nbNodes, blockProp, connectParam, model = "gaussian") plot(mySampler) plot(mySampler,type='meso') hist(mySampler\$networkData) ```

GrossSBM/sbm documentation built on Oct. 8, 2021, 6:23 p.m.