
Last chance! 50% off unlimited learning
Sale ends in
Sets the initial conditions for stochastic network models
simulated with netsim
.
init.net(i.num, r.num, i.num.m2, r.num.m2, status.vector, infTime.vector, ...)
Number of initial infected. For bipartite models, this is the number of initial mode 1 infected.
Number of initial recovered. For bipartite models, this is the
number of initial mode 1 recovered. This parameter is only used for
the SIR
model type.
Number of initial infected in mode 2. This parameter is only used for bipartite models.
Number of initial recovered in mode 2. This parameter is
only used for bipartite SIR
models.
A vector of length equal to the size of the input network,
containing the status of each node. Setting status here overrides any
inputs passed in the .num
arguments.
A vector of length equal to the size of the input network,
containing the (historical) time of infection for each of those nodes
with a current status of "i"
. Can only be used if status.vector
is used, and must contain NA
values for any nodes whose status
is not "i"
.
Additional initial conditions passed to model.
The initial conditions for a model solved with netsim
should be
input into the init.net
function. This function handles initial
conditions for both base models and new modules. For an overview of
specifying initial conditions across a variety of base network models,
consult the Basic Network
Models tutorial.
Use param.net
to specify model parameters and
control.net
to specify the control settings. Run the
parameterized model with netsim
.
# NOT RUN {
# Example of using status.vector and infTime.vector together
n <- 100
status <- sample(c("s", "i"), size = n, replace = TRUE, prob = c(0.8, 0.2))
infTime <- rep(NA, n)
infTime[which(status == "i")] <- -rgeom(sum(status == "i"), prob = 0.01) + 2
init.net(status.vector = status, infTime.vector = infTime)
# }
Run the code above in your browser using DataLab