# NOT RUN {
## Create an 'SIR' model with 100 nodes and initialise
## it with 990 susceptible individuals and 10 infected
## individuals in each node. Run the model over 100 days.
model <- SIR(u0 = data.frame(S = rep(990, 100),
I = rep(10, 100),
R = rep(0, 100)),
tspan = 1:100,
beta = 0.16,
gamma = 0.077)
## Run the model and save the result.
result <- run(model)
## Plot the median and interquartile range of the number
## of susceptible, infected and recovered individuals.
plot(result)
## Plot the median and the middle 95\% quantile range of the
## number of susceptible, infected and recovered individuals.
plot(result, range = 0.95)
## Plot the median and interquartile range of the number
## of infected individuals.
plot(result, compartments = "I")
## Plot the number of susceptible, infected
## and recovered individuals in the first
## three nodes.
plot(result, node = 1:3, range = FALSE)
## Use a stair step plot type instead.
plot(result, node = 1:3, range = FALSE, type = "s")
## Plot the number of infected individuals in the first node.
plot(result, compartments = "I", node = 1, range = FALSE)
# }
Run the code above in your browser using DataLab