Run the SimInf stochastic simulation algorithm
Usage
run(model, ...)
# S4 method for class 'SimInf_model'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SEIR'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SIR'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SIS'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SISe'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SISe3'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SISe3_sp'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SISe_sp'
run(model, solver = c("ssm", "aem"), ...)
# S4 method for class 'SimInf_abc'
run(model, ...)
Value
SimInf_model
object with result from
simulation.
Examples
## For reproducibility, call the set.seed() function and specify
## the number of threads to use. To use all available threads,
## remove the set_num_threads() call.
set.seed(123)
set_num_threads(1)
## Create an 'SIR' model with 10 nodes and initialise
## it to run over 100 days.
model <- SIR(u0 = data.frame(S = rep(99, 10),
I = rep(1, 10),
R = rep(0, 10)),
tspan = 1:100,
beta = 0.16,
gamma = 0.077)
## Run the model and save the result.
result <- run(model)
## Plot the proportion of susceptible, infected and recovered
## individuals.
plot(result)