SIRS2nets | R Documentation |
A function to run the simulation of disease spread in two networks with the same nodes using the SIRS (Susceptible-Infected-Recovered-Susceptible) model.
SIRS2nets( A1, A2, pspread1, pspread2, tSim, I, tImin, tImax, R, tRmin, tRmax, Control )
A1 |
The adjacency |
A2 |
The adjacency |
pspread1 |
Probability of disease spread from an infected to a susceptible node in network 1 |
pspread2 |
Probability of disease spread from an infected to a susceptible node in network 2 |
tSim |
Simulation time |
I |
Vector of infected nodes (initial condition) |
tImin |
Minimum time a node remains infected |
tImax |
Maximum time a node remains infected |
R |
Vector of recovered nodes (initial condition) |
tRmin |
Minimum time a node remains immune |
tRmax |
Maximum time a node remains immune |
Control |
Vector of nodes under a control strategy |
This function runs the simulation of disease spread in two networks
with the same nodes using the SIRS model. For each time step,
the vectors of infected, susceptible and recovered nodes are updated,
considering that there are probabilities pspread1
and pspread2
of disease spread in networks 1 and 2, respectively.
Thus, infection can be transmitted by either network.
Infected nodes remain infected during a time randomly
sampled between tImin
and tImax
.
Recovered nodes remain immune during a time randomly sampled
between tRmin
and tRmax
. Nodes under a
control strategy (Control
) are not susceptible to infection.
A list of
M_Sim_I |
a matrix of infected nodes for each time step. |
M_Sim_R |
a matrix of recovered nodes for each time step. |
[1] Ossada R, Grisi-Filho JHH, Ferreira F, Amaku M (2013). "Modeling the Dynamics of Infectious Diseases in Different Scale-Free Networks with the Same Degree Distribution." Advanced Studies in Theoretical Physics, 7, 759-771. doi: 10.12988/astp.2013.3674
[2] Ossada R (2015). "Modelagem de Medidas de Controle em Redes de Movimentacao de Animais." PhD Thesis. Sao Paulo, School of Veterinary Medicine, University of Sao Paulo. doi: 10.11606/T.10.2015.tde-06112015-111048
# Generate two arbitrary 200 by 200 adjacency matrix with zeros and ones # Remove loops A1 <- matrix(rbinom(200 * 200, 1, 0.1), ncol = 200, nrow = 200) diag(A1) <- 0 A2 <- matrix(rbinom(200 * 200, 1, 0.05), ncol = 200, nrow = 200) diag(A2) <- 0 # Setting the parameters pspread1 <- 0.05 pspread2 <- 0.1 tImin <- 5 tImax <- 8 tRmin <- 1 tRmax <- 10 tSim <- 100 # Setting the initial conditions for infected, recovered and controlled nodes num_infected <- 2 # initial number of infected nodes I <- rep(x = 0, times = nrow(A)) I[1:num_infected] <- 1 I <- sample(I) R <- rep(x = 0, times = nrow(A)) Control <- rep(x = 0, times = nrow(A)) # Run the simulation sim2nets <- SIRS2nets(A1 = A1, A2 = A2, pspread1 = pspread1, pspread2 = pspread2, tSim = tSim, I = I, tImin = tImin, tImax = tImax, R = R, tRmin = tRmin, tRmax = tRmax, Control = Control) # Plot the prevalence over time plot(colMeans(sim2nets[[1]]>0), xlab = "Time", ylab = "Prevalence")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.