# Initialize bipartite network
num.m1 <- 100
num.m2 <- 100
nw <- network.initialize(num.m1 + num.m2,
bipartite=num.m1, directed=FALSE)
# Set mode-specific fractional degree distributions
deg.dist.m1 <- c(0.40, 0.55, 0.04, 0.01)
deg.dist.m2 <- c(0.48, 0.41, 0.08, 0.03)
# Set model parameters and control arguments
formation <- ~ edges + b1degree(0:1) + b2degree(0:1)
target.stats <- c(66, 40, 55, 48, 41)
dissolution <- ~ offset(edges)
duration <- 25
coef.diss <- dissolution.coefs(dissolution, duration)
# Estimate the model with all the parameters set above
est <- epiNet.est(
nw,
formation,
dissolution,
target.stats,
coef.diss)
est
# Simulate 5 networks over 100 timesteps
nwsims <- epiNet.simNet(est, nsteps = 100, nsims = 5)
# Print the object, plot the formation summary, plot the duration summary
nwsims
plot(nwsims, sim=2)
plot(nwsims, type = "duration", sim = 2)
Run the code above in your browser using DataLab