Extract networkDynamic Object from Network Epidemic Model

Share:

Description

Extracts the networkDynamic object from a network epidemic model simulated with netsim, with the option to collapse the extracted network at a specific time step.

Usage

1
get_network(x, sim = 1, network = 1, collapse = FALSE, at)

Arguments

x

An EpiModel object of class netsim.

sim

Simulation number of extracted network.

network

Network number, for simulations with multiple networks representing the population.

collapse

If TRUE, collapse the networkDynamic object to a static network object at a specified time step.

at

If collapse is used, the time step at which the extracted network should be collapsed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
## Simulate SI epidemic on bipartite Bernoulli random graph
nw <- network.initialize(n = 100, bipartite = 50, directed = FALSE)
formation <- ~edges
target.stats <- 50
coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 20)
est <- netest(nw, formation, target.stats, coef.diss, verbose = FALSE)
param <- param.net(inf.prob = 0.3, inf.prob.m2 = 0.15)
init <- init.net(i.num = 10, i.num.m2 = 10)
control <- control.net(type = "SI", nsteps = 10, nsims = 3, verbose = FALSE)
mod <- netsim(est, param, init, control)

## Extract the network from simulation 2
get_network(mod, sim = 2)

## Extract and collapse the network from simulation 1
get_network(mod, collapse = TRUE, at = 5)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.