Skip to contents

Network models in epiworld

Usage

agents_sbm(model, block_sizes, mixing_matrix)

# S3 method for class 'epiworld_model'
agents_sbm(model, block_sizes, mixing_matrix)

Arguments

model

Model object of class epiworld_model.

block_sizes

Integer vector describing the size of each block in the SBM.

mixing_matrix

Numeric matrix describing the mixing between blocks in the SBM.

Value

  • The function agents_sbm generates an stochastic block model (SBM) network.

References

Batagelj, V., & Brandes, U. (2005). Efficient generation of large random networks. Physical Review E, 71(3), 036113. doi:10.1103/PhysRevE.71.036113

Examples

# Initializing SIR model with SBM network
sir <- ModelSIR(name = "COVID-19", prevalence = 0.01, transmission_rate = 0.9,
  recovery_rate = 0.1)
agents_sbm(
  sir,
  block_sizes = c(500, 500),
  mixing_matrix = matrix(c(0.9, 0.1, 0.1, 0.9), nrow = 2)
)
run(sir, ndays = 100, seed = 1912)
#> _________________________________________________________________________
#> Running the model...
#> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
sir
#> ________________________________________________________________________________
#> Susceptible-Infected-Recovered (SIR)
#> It features 1000 agents, 1 virus(es), and 0 tool(s).
#> The model has 3 states.
#> The final distribution is: 854 Susceptible, 0 Infected, and 146 Recovered.