I would like to test susceptible-infected-removed (SIR) models.
I taken the core code from the Kolaczyk and Csárdi book (Section 8.5, pp. 157-158).
library(igraph)
gl <- list()
gl$er <- erdos.renyi.game(250, 1250, type=c("gnm"))
gl$ba <- barabasi.game(250, m=5, directed=FALSE)
gl$ws <- watts.strogatz.game(1, 100, 12, 0.01)
And decrese the no.sim
from 100 to 10.
sim <- lapply(gl, sir, beta=0.5, gamma=1, no.sim=10)
Then I added some commands in order to plot the characterization of an SIR process, showing how the relative proportions of those susceptible (NS, green), infective (NI, blue), and removed (NR, red) vary over time for three used graph models: Erdos-Renyi (er), Barabasi (ba), Watts-Strogatz (ws).
x.max <- max(sapply(sapply(sim, time_bins), max))
y.maxNI <- 1.05 * max(sapply(sapply(sim, function(x) median(x)[["NI"]]), max, na.rm=TRUE))
y.maxNS <- 1.05 * max(sapply(sapply(sim, function(x) median(x)[["NS"]]), max, na.rm=TRUE))
y.maxNR <- 1.05 * max(sapply(sapply(sim, function(x) median(x)[["NR"]]), max, na.rm=TRUE))
y.max <- max(y.maxNI, y.maxNS, y.maxNR)
par(mfrow=c(1,3))
#################################################################################
plot(time_bins(sim$er), median(sim$er)[["NI"]], type="l", lwd=2, col="blue", xlim=c(0, x.max), ylim=c(0, y.max), xlab="Time", ylab="Proportion of Population")
lines(time_bins(sim$er), median(sim$er)[["NS"]], type="l", lwd=2, col="green")
lines(time_bins(sim$er), median(sim$er)[["NR"]], type="l", lwd=2, col="red")
#################################################################################
plot(time_bins(sim$ba), median(sim$ba)[["NI"]], type="l", lwd=2, col="blue", xlim=c(0, x.max), ylim=c(0, y.max), xlab="Time", ylab="Proportion of Population")
lines(time_bins(sim$ba), median(sim$ba)[["NS"]], type="l", lwd=2, col="green")
lines(time_bins(sim$ba), median(sim$ba)[["NR"]], type="l", lwd=2, col="red")
#################################################################################
plot(time_bins(sim$ws), median(sim$ws)[["NI"]], type="l", lwd=2, col="blue", xlim=c(0, x.max), ylim=c(0, y.max), xlab="Time", ylab="Proportion of Population")
lines(time_bins(sim$ws), median(sim$ws)[["NS"]], type="l", lwd=2, col="green")
lines(time_bins(sim$ws), median(sim$ws)[["NR"]], type="l", lwd=2, col="red")
The results are below:
In the network-based analogue of the tradition SIR process then follows by defining the processes NS(t),NI(t), and NR(t), counting the numbers of susceptible, infective, and removed vertices at time t, respectively, in analogy to the traditional case.
But as one can see the sum of proportions NS(t)+NI(t)+NR(t)
equals to 100 only for the Watts-Strogatz model.
Question. I would like to know what is a reason that NS(t)+NI(t)+NR(t) > 100
for the Erdos-Renyi (er), Barabasi (ba) model?
The error in my code or in models side?
Aucun commentaire:
Enregistrer un commentaire