EpiModel-Gallery
EpiModel-Gallery copied to clipboard
Simple Templates
- [x] One mode SI
- [ ] Two mode SIS with
nodematch
for dissortative mixing and group-specific infection probabilities and recovery rates
For the two-model SIS example, this could be starter code for the network model:
# Network initialization
n <- 500
nw <- network.initialize(n, directed = FALSE)
nw <- set.vertex.attribute(nw, "male", rbinom(n, 1, 0.5))
nw %v% "male"
# formation formula
formation <- ~edges + nodematch("male") + degrange(from = 4)
# formation target stats
mean_deg <- 0.75
prop_hetero <- 1
prop_deg4pl <- 0
edges <- mean_deg * n/2
nodematch <- edges * (1 - prop_hetero)
degrange <- n * prop_deg4pl
target_stats <- c(edges, nodematch, degrange)
# dissolution model
diss <- dissolution_coefs(~offset(edges), duration = 50)
est <- netest(nw,
formation = formation,
target.stats = target_stats,
coef.diss = diss)
# diagnostics
dx <- netdx(est, nsims = 10, nsteps = 500)
print(dx)
plot(dx, plots.joined = FALSE)