Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Templates #5

Open
1 of 2 tasks
smjenness opened this issue Aug 13, 2018 · 1 comment
Open
1 of 2 tasks

Simple Templates #5

smjenness opened this issue Aug 13, 2018 · 1 comment

Comments

@smjenness
Copy link
Contributor

smjenness commented Aug 13, 2018

  • One mode SI
  • Two mode SIS with nodematch for dissortative mixing and group-specific infection probabilities and recovery rates
@smjenness
Copy link
Contributor Author

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)

@andsv2 andsv2 removed their assignment Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants