{"word_count": 319, "character_count": 3109}
When introducing the SIR model, in our initial post, we got an ordinary differential equation, but we did not really discuss stability, and periodicity. It has to do with the Jacobian matrix of the system. But first of all, we had three equations for three function, but actually[latex display="true"]\displaystyle{{\frac{dS}{dt}}+{\frac {dI}{dt}}+{\frac {dR}{dt}}=0}[/latex]so it means that our problem is here simply in dimension 2. Hence[latex display="true"]\displaystyle {\begin{aligned}&#38;X={\frac {dS}{dt}}=\mu(N-S)-{\frac {\beta IS}{N}},\\[6pt]&#38;Y={\frac {dI}{dt}}={\frac {\beta IS}{N}}-(\mu+\gamma)I\end{aligned}}[/latex]and therefore, the Jacobian of the system is[latex display="true"]\begin{pmatrix}\displaystyle{\frac{\partial X}{\partial S}}&#38;\displaystyle{\frac{\partial X}{\partial I}}\\[9pt]\displaystyle{\frac{\partial Y}{\partial S}}&#38;\displaystyle{\frac{\partial Y}{\partial I}}\end{pmatrix}=\begin{pmatrix}\displaystyle{-\mu-\beta\frac{I}{N}}&#38;\displaystyle{-\beta\frac{S}{N}}\\[9pt]\displaystyle{\beta\frac{I}{N}}&#38;\displaystyle{\beta\frac{S}{N}-(\mu+\gamma)}\end{pmatrix}[/latex]We should evaluate the Jacobian at the equilibrium, i.e. [latex display="true"]S^\star=\frac{\gamma+\mu}{\beta}=\frac{1}{R_0}[/latex]and[latex display="true"]I^\star=\frac{\mu(R_0-1)}{\beta}[/latex]We should then look at eigenvalues of the matrix.Our very last example wastimes = seq(0, 100, by=.1)p = c(mu = 1/100, N = 1, beta = 50, gamma = 10)start_SIR = c(S=0.19, I=0.01, R = 0.8)resol = ode(y=start_SIR, t=times, func=SIR, p=p)plot(resol[,"time"],resol[,"I"],type="l",xlab="time",ylab="")We can compute values at the equilibriummu=p["mu"]; beta=p["beta"]; gamma=p["gamma"]N=1S = (gamma + mu)/betaI = mu * (beta/(gamma + mu) - 1)/betaand the Jacobian matrixJ=matrix(c(-(mu + beta * I/N),-(beta * S/N),         beta * I/N,beta * S/N - (mu + gamma)),2,2,byrow = TRUE)Now, if we look at the eigenvalues,eigen(J)$values[1] -0.024975+0.6318831i -0.024975-0.6318831ior more precisely [latex]2\pi/b[/latex] where [latex]a\pm ib[/latex] are the conjuguate eigenvalues2 * pi/(Im(eigen(J)$values[1]))[1] 9.943588we have a damping period of 10 time lengths (10 days, or 10 weeks), which is more or less what we've seen above,The graph above was obtained usingp = c(mu = 1/100, N = 1, beta = 50, gamma = 10)start_SIR = c(S=0.19, I=0.01, R = 0.8)resol = ode(y=start_SIR, t=times, func=SIR, p=p)plot(resol[1:1e5,"time"],resol[1:1e5,"I"],type="l",xlab="time",ylab="",lwd=3,col="red")yi=resol[,"I"]dyi=diff(yi)i=which((dyi[2:length(dyi)]*dyi[1:(length(dyi)-1)])&#60;0)t=resol[i,"time"]arrows(t[2],.008,t[4],.008,length=.1,code=3)If we look carefully. at the begining, the duration is (much) longer than 10 (about 13)... but it does converge towards 9.94plot(diff(t[seq(2,40,by=2)]),type="b")abline(h=2 * pi/(Im(eigen(J)$values[1]))So here, theoretically, every 10 weeks (assuming that our time length is a week), we should observe an outbreak, smaller than the previous one. In practice, initially it is every 13 or 12 weeks, but the time to wait between outbreaks decreases (until it reaches 10 weeks).