## For reproducibility, specify the number of threads.
set_num_threads(1)
## Create an 'SIR' model with 10 nodes.
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 with a fixed seed for reproducibility.
result <- run(model, seed = 22)
## Create a scatterplot matrix for all compartments across all
## nodes.
pairs(result)
## Create a scatterplot matrix for the S and I compartments,
## using only data from nodes 1 and 2.
pairs(result, compartments = c("S", "I"), index = 1:2)
Run the code above in your browser using DataLab