EpiModel-Gallery icon indicating copy to clipboard operation
EpiModel-Gallery copied to clipboard

Simple Templates

Open smjenness opened this issue 6 years ago • 1 comments

  • [x] One mode SI
  • [ ] Two mode SIS with nodematch for dissortative mixing and group-specific infection probabilities and recovery rates

smjenness avatar Aug 13 '18 15:08 smjenness

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)

smjenness avatar Nov 26 '18 15:11 smjenness