Kuba Suder’s Coronavirus charts
Coronavirus : suivez la propagation de la pandémie en France et dans le monde, Le Monde
Why outbreaks like coronavirus spread exponentially, and how to flatten the curve, Washington Post
COVID-19 Coronavirus Infographic Data Pack
Coronavirus tracked: the latest figures as the pandemic spreads, Financial Times
Minute Physics: Comment savoir si nous gagnons contre le COVID-19 ?
Coronavirus Disease (COVID-19) – Statistics and Research
Collaborative Google Sheets on Policy Measures Against Covid19
Top 35 R resources on Novel COVID-19 Coronavirus
\[N(t) = N_{0}e^{rt}\]
EXP<-function(r,I0=1,days=30,dt=0.01){
k<-seq(0,days,dt)
m<-matrix(NA,nrow=length(k),ncol=length(r))
colnames(m)<-r
rownames(m)<-k
m[1,]<-I0
dN<-function(I){r*I}
for(i in 2:length(k)){
m[i,]<-m[i-1,]+dt*dN(m[i-1,])
}
m
}
r<-c(0.1,0.2)
days<-30
dt<-0.01
x<-EXP(r=r,I0=1,days=days,dt=dt)
matplot(x,type="l",xlab="Days",ylab="Nombre de cas cumulatifs",lty=1,lwd=2,xaxs="i",yaxs="i",log="",xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
\[\frac{dN}{dt} = rN(t)\left(1-\frac{N(t)}{K}\right)\]
RLG<-function(r,a=1,K=c(100,1000,2000),I0=1,dt=0.01,days=30){
k<-seq(0,days,dt)
m<-matrix(NA,nrow=length(k),ncol=length(K))
colnames(m)<-K
rownames(m)<-k
m[1,]<-I0
dI<-function(I){r*I*(1-(I/K)^a)}
for(i in 2:length(k)){
m[i,]<-m[i-1,]+dt*dI(m[i-1,])
}
m
}
K<-c(100,1000,2000)
dt<-0.01
days<-30
x<-RLG(r=1.1,a=1,K=K,I0=1,dt=dt,days=days)
matplot(x,type="l",xlab="Days",ylab="Nombre de cas cumulatifs",lty=1,lwd=2,xaxs="i",yaxs="i",log="",xaxt="n",ylim=c(0,max(K)*1.1))
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
legend("topleft",legend=paste("K =",K),bty="n",col=1:3,lwd=2)
\[\frac{dN}{dt} = rN(t)\left(1-\left(\frac{N(t)}{K}\right)^a\right)\]
RLG<-function(r,a,K,I0,dt,days){
k<-seq(0,days,dt)
m<-matrix(NA,nrow=length(k),ncol=length(a))
colnames(m)<-a
rownames(m)<-k
m[1,]<-I0
dI<-function(I){r*I*(1-(I/K)^a)}
for(i in 2:length(k)){
m[i,]<-m[i-1,]+dt*dI(m[i-1,])
}
m
}
a<-c(0.2,0.5,1)
days<-30
dt<-0.01
x<-RLG(r=1.5,a=a,K=10000,I0=1,dt=dt,days=days)
matplot(x,type="l",xlab="Days",ylab="Nombre de cas cumulatifs",lty=1,lwd=2,xaxs="i",yaxs="i",log="",xaxt="n",ylim=c(0,10000*1.1))
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
legend("right",legend=paste("a =",a),bty="n",col=1:3,lwd=2)
\[\frac{dN}{dt} = rN(t)^{p}\]
GGM<-function(r,p,I0=1,dt=0.1,days=5){
k<-seq(0,days,dt)
m<-matrix(NA,nrow=length(k),ncol=length(p))
colnames(m)<-p
rownames(m)<-k
m[1,]<-I0
dI<-function(I){r*I^p}
for(i in 2:length(k)){
m[i,]<-m[i-1,]+dt*dI(m[i-1,])
}
m
}
p<-c(0.5,0.9,1)
days<-30
dt<-0.01
x<-GGM(r=0.2,p=p,I0=1,dt=dt,days=days)
par(mfrow=c(1,2))
matplot(x,type="l",xlab="Times",ylab="Nombre de cas cumulatifs",lty=1,lwd=2,xaxs="i",yaxs="i",log="",xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
matplot(x,type="l",xlab="Times",ylab="Nombre de cas cumulatifs",lty=1,lwd=2,xaxs="i",yaxs="i",log="y",xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
legend("topleft",legend=paste("p =",p),bty="n",col=1:length(p),lwd=2)
\[\mathbf{S}usceptible - \mathbf{I}nfected - \mathbf{R}ecovered\]
\[\frac{dS}{dt} = -\beta \frac{SI}{N}\]
\[\frac{dI}{dt} = \beta \frac{SI}{N}-\gamma I\]
\[\frac{dR}{dt} = \gamma I\]
\[\frac{d}{dt}(S+I+R) = 0\]
\(\beta\): taux de transmission
\(\gamma\): taux de guérison
\(N\): population totale
\[R_{0} = \frac{\beta}{\gamma}\]
SIR<-function(S0,I0,beta,gamma,dt,days){
N0<-S0+I0
k<-seq(0,days,dt)
m<-matrix(NA,ncol=3,nrow=length(k))
colnames(m)<-c("S","I","R")
rownames(m)<-k
m[1,]<-c(S0,I0,N0-S0-I0)
dS<-function(S,I){-beta*I*S/N0}
dI<-function(S,I){beta*I*S/N0-gamma*I}
for(i in 2:length(k)){
S<-m[i-1,1]
I<-m[i-1,2]
m[i,1]<-S+dt*dS(S,I)
m[i,2]<-I+dt*dI(S,I)
}
m[,3]<-N0-m[,1]-m[,2]
m
}
beta<-c(3,3,3)
gamma<-c(0.5,1.5,2.5)
days<-30
dt<-0.01
par(mfrow=c(1,3))
l<-lapply(seq_along(beta),function(i){
x<-SIR(S0=10^4,I0=1,beta=beta[i],gamma=gamma[i],dt=dt,days=days)
matplot(x,type="l",xlab="Days",ylab="Population size",lty=1,lwd=2,xaxs="i",yaxs="i",xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
mtext(side=3,text=bquote(beta == .(beta[i]) ~~ gamma == .(gamma[i])))
legend("right",legend=c("Susceptible","Infected","Recovered"),bty="n",col=1:3,lwd=2)
})
\[\mathbf{S}usceptible - \mathbf{E}xposed - \mathbf{I}nfectious - \mathbf{R}ecovered\]
\[\frac{dS}{dt} = -\beta \frac{SI}{N}\]
\[\frac{dE}{dt} = \beta \frac{SI}{N}-\sigma E\]
\[\frac{dI}{dt} = \sigma E-\gamma I\]
\[\frac{dR}{dt} = \gamma I\]
\[\frac{d}{dt}(S+E+I+R) = 0\]
\(\beta\): taux de transmission
\(\sigma\): taux de développement des symptômes
\(\gamma\): taux de guérison
\(N\): population totale
SEIR<-function(S0,I0,beta,gamma,sigma,dt,days){
N0<-S0+I0
k<-seq(0,days,dt)
m<-matrix(NA,ncol=4,nrow=length(k))
colnames(m)<-c("S","E","I","R")
rownames(m)<-k
m[1,]<-c(S0,I0,0,0)
dS<-function(S,I){-beta*I*S/N0}
dE<-function(S,I){beta*I*S/N0-sigma*E}
dI<-function(S,I){sigma*E-gamma*I}
for(i in 2:length(k)){
S<-m[i-1,1]
E<-m[i-1,2]
I<-m[i-1,3]
m[i,1]<-S+dt*dS(S,I)
m[i,2]<-E+dt*dE(S,I)
m[i,3]<-I+dt*dI(S,I)
}
m[,4]<-N0-m[,1]-m[,2]-m[,3]
m
}
beta<-c(3,3,3)
sigma<-c(2,1,0.5)
gamma<-c(0.5,0.5,0.5)
dt<-0.01
days<-30
par(mfrow=c(1,3))
l<-lapply(seq_along(beta),function(i){
x<-SEIR(S0=10^4,I0=1,beta=beta[i],sigma=sigma[i],gamma=gamma[i],dt=dt,days=days)
cols<-c(1,"orange",2,3)
matplot(x,type="l",xlab="Days",ylab="Population size",lty=1,lwd=2,xaxs="i",yaxs="i",col=cols,xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
mtext(side=3,text=bquote(beta == .(beta[i]) ~~ gamma == .(gamma[i])~~ sigma == .(sigma[i]) ))
legend("right",legend=c("Susceptible","Exposed","Infectious","Recovered"),bty="n",col=cols,lwd=2)
})
\[\beta(t) = \beta_{0}((1-\phi)e^{-qt}+\phi)\]
\(\beta_{0}\): taux d’infection initial
\(\phi\): proportion de la valeur initiale de \(\beta_{0}\) jusqu’où la décroissance se rend
\(q\): taux de diminution de \(\beta\)
bt<-function(t,beta0,phi,q){beta0*(((1-phi)*exp(-q*t))+phi)}
days<-seq(0,30)
beta0<-c(3,3,3)
phi<-c(0.0,0.5,0.5)
q<-c(0.3,0.3,0.001)
par(mfrow=c(1,3))
l<-lapply(seq_along(beta0),function(i){
x<-bt(days,beta0[i],q=q[i],phi=phi[i])
plot(x,type="l",xlab="Days",ylab=expression(beta),lty=1,lwd=2,xaxs="i",yaxs="i",ylim=c(0,max(beta0)))
mtext(side=3,text=bquote(phi == .(phi[i]) ~~ q == .(q[i])))
})
\[\frac{dS}{dt} = -\beta(t) \frac{SI}{N}\]
\[\frac{dI}{dt} = \beta(t) \frac{SI}{N}-\gamma I\]
\[\frac{dR}{dt} = \gamma I\]
\[\beta(t) = \beta_{0}((1-\phi)e^{-qt}+\phi)\]
SIRb<-function(S0,I0,beta0,gamma,q,phi,dt,days){
N0<-S0+I0
k<-seq(0,days,dt)
m<-matrix(NA,ncol=4,nrow=length(k))
colnames(m)<-c("S","I","R","beta")
rownames(m)<-k
m[1,]<-c(S0,I0,N0-S0-I0,beta0)
bt<-function(t){beta0*(((1-phi)*exp(-q*t))+phi)}
dS<-function(b,S,I){-b*I*S/N0}
dI<-function(b,S,I){b*I*S/N0-gamma*I}
for(i in 2:length(k)){
S<-m[i-1,1]
I<-m[i-1,2]
beta<-bt(i)
m[i,1]<-S+dt*dS(beta,S,I)
m[i,2]<-I+dt*dI(beta,S,I)
}
m[,3]<-N0-m[,1]-m[,2]
m
}
beta0<-c(3,3,3)
gamma<-c(1,1,1)
phi<-c(0.1,0.1,0.1)
q<-c(0.0025,0.0015,0.0001)
days<-30
dt<-0.01
phi<-c(0.0,0.5,0.5)
q<-c(0.3,0.3,0.001)
par(mfrow=c(1,3))
l<-lapply(seq_along(beta0),function(i){
x<-SIRb(S0=10^4,I0=1,beta0=beta0[i],gamma=gamma[i],q=q[i],phi=phi[i],dt=dt,days=days)
matplot(x,type="l",xlab="Times",ylab="Population size",lty=1,lwd=2,xaxs="i",yaxs="i",xaxt="n")
axis(1,at=seq(1,nrow(x),by=1/dt),labels=rownames(x)[seq(1,nrow(x),by=1/dt)])
mtext(side=3,text=bquote(phi == .(phi[i]) ~~ q == .(q[i])))
legend("right",legend=c("Susceptible","Infected","Recovered"),bty="n",col=1:3,lwd=2)
x
})