toy_epi_sim | R Documentation |
An example network of a trivial simulated disease process spreading over a simulated dynamic contact network among 100 individuals for 25 discrete time steps.
data("toy_epi_sim")
The format is a networkDynamic
object with attached attributes for vertex.pid
(persistand ids), and dynamic attributes for ndtvcol
(color corresponding to infection status) and testatus
(infection status of vertices)
The toy_epi_sim
network is example output from a basic dynamic network STERGM simulation and trivial "SI" infection simulation generated using the EpiModel package. The model had random ("edges only") edge formation and dissolution effects, with rates calculated to lead to mean edge durations of 10 time units. The infection simulation had an infection probability of 0.8.
The simulation was generated with the following code:
library(EpiModel) ## Network Estimation (using a tergm model) nw <- network.initialize(n = 100, directed = FALSE) formation <- ~ edges target.stats <- 50 dissolution <- ~ offset(edges) coef.diss <- dissolution_coefs(dissolution, duration = 10) est <- netest(nw, formation, dissolution, target.stats, coef.diss, verbose = FALSE) ## Epidemic simulation param <- param.net(inf.prob = 0.8) init <- init.net(i.num = 5) control <- control.net(type = "SI", nsteps = 25, nsims = 1, verbose = FALSE) sim <- netsim(est, param, init, control) ## Use some of EpiModel's default coloring functions to cache colors toy_epi_sim <- get_network(sim) toy_epi_sim <- color_tea(toy_epi_sim)
Samuel Jenness, Steven M. Goodreau and Martina Morris (2015). EpiModel: Mathematical Modeling of Infectious Disease. R package version 1.1.4. https://CRAN.R-project.org/package=EpiModel
Statnet EpiModel Tutorial https://www.epimodel.org/
See also short.stergm.sim
for another basic Stergm simulation output, and msm.sim
for a larger and more complex simulation without an infection process.
data(toy_epi_sim)
timeline(toy_epi_sim)
## Not run:
# set up layout to draw plots under timeline
layout(matrix(c(1,1,1,2,3,4),nrow=2,ncol=3,byrow=TRUE))
# plot a proximity.timeline illustrating infection spread
proximity.timeline(toy_epi_sim,vertex.col = 'ndtvcol',
spline.style='color.attribute',
mode = 'sammon',default.dist=100,
chain.direction='reverse')
# plot 3 static cross-sectional networks
# (beginning, middle and end) underneath for comparison
plot(network.collapse(toy_epi_sim,at=1),vertex.col='ndtvcol',
main='toy_epi_sim network at t=1')
plot(network.collapse(toy_epi_sim,at=17),vertex.col='ndtvcol',
main='toy_epi_sim network at=17')
plot(network.collapse(toy_epi_sim,at=25),vertex.col='ndtvcol',
main='toy_epi_sim network at t=25')
layout(1) # reset the layout
# render an animation of the network
render.animation(toy_epi_sim,vertex.col='ndtvcol',displaylabels=FALSE)
ani.replay()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.