CovidSIRDc

class aftercovid.models.CovidSIRDc[source]

Inspiration Modelling some COVID-19 data. This model considers that observed data are not the true ones.

\[\begin{split}\begin{array}{rcl} S &=& S_{obs} (1 + a)\\ I &=& I_{obs} (1 + b)\\ R &=& R_{obs} (1 + c)\\ D &=& D_{obs} \end{array}\end{split}\]

Where \(S\), \(I\), \(R\) are \(R_{obs}\) are observed. hidden, only \(S_{obs}\), \(I_{obs}\), The following equality should be verified: \(S + I + R + D = N = S_{obs} + I_{obs} + R_{obs} + D_{obs}\). We also get from the previous equations:

\[\begin{split}\begin{array}{rcl} dS &=& dS_{obs} (1 + a) = - \beta \frac{IS}{N} = - \beta \frac{I_{obs}S_{obs}}{N}(1+a)(1+b) \\ \Longrightarrow dS_{obs} &=& - \beta \frac{I_{obs}S_{obs}}{N}(1+b) \end{array}\end{split}\]

And also:

\[\begin{array}{rcl} dD &=& dD_{obs} = \nu I = \nu I_{obs} (1+b) \end{array}\]

And as well:

\[\begin{split}\begin{array}{rcl} dR &=& dR_{obs} (1 + c) = \mu I = \mu (1 + b) I_{obs} \\ \Longrightarrow dR_{obs} &=& - \nu I_{obs} \frac{1+b}{1+c} \end{array}\end{split}\]

And finally:

\[\begin{split}\begin{array}{rcl} dI &=& dI_{obs} (1 + b) = -dR - dS - dD = - \mu \frac{1 + b}{1+ c} I_{obs} - \nu (1+b) I_{obs} - - \beta I_{obs}\frac{S_{obs}}{N} (1 + a)(1 + b) \\ \Longrightarrow dI_{obs} &=& - \nu I_{obs} - \mu I_{obs} - \beta I_{obs}\frac{S_{obs}}{N} (1 + a) \end{array}\end{split}\]

This model should still verify:

\[\begin{split}\begin{array}{rcl} S_{obs} + I_{obs} + R_{obs} + D_{obs} &=& N = S + I + R + D \\ &=& S_{obs}(1+a) + I_{obs}(1+b) + R_{obs}(1+c) + D_{obs} \end{array}\end{split}\]

That gives \(a S_{obs} + b I_{obs} + c R_{obs} = 0\).

<<<

from aftercovid.models import CovidSIRDc

model = CovidSIRDc()
print(model.to_rst())

>>>

CovidSIRDc

Quantities

  • S: personnes non contaminées

  • I: nombre de personnes malades ou contaminantes

  • R: personnes guéries (recovered)

  • D: personnes décédées

Constants

  • N: population

Parameters

  • beta: taux de transmission dans la population

  • mu: 1/. : durée moyenne jusque la guérison

  • nu: 1/. : durée moyenne jusqu’au décès

  • a: paramètre gérant les informations cachées (S)

  • b: paramètre gérant les informations cachées (I)

  • c: paramètre gérant les informations cachées (R)

Equations

\[\begin{split}\begin{array}{l} \frac{dD}{dt} = I \nu \left(b + 1\right) \\ \frac{dI}{dt} = - I \mu - I \nu + \frac{I S \beta \left(a + 1\right)}{N} \\ \frac{dR}{dt} = \frac{I \mu \left(b + 1\right)}{c + 1} \\ \frac{dS}{dt} = - \frac{I S \beta \left(b + 1\right)}{N} \end{array}\end{split}\]

SIRDc simulation and plotting

(Source code, png, hires.png, pdf)

_images/model_covidsir_cst-1.png

Visual representation:

See Base implementation for SIR models to get the methods common to SIRx models. This model is not really working better than CovidSIRD.

R0(t=0)[source]

Returns R0 coefficient. See CovidSIRD.R0

static add_noise(X, epsilon=1.0)[source]

Tries to add reasonable noise to the quantities stored in X.

Parameters

epsilon – amplitude

Returns

new X

correctness(X=None)[source]

Returns \(a S_{obs} + b I_{obs} + c R_{obs} = 0\).

Parameters

X – None to use inner quantities

Returns

a number

rnd()[source]

Draws random parameters. Not perfect.

update_abc(X=None, update=True, alpha=1.0, l1_ratio=0.5)[source]

Updates coefficients a, b, c so that method correctness returns 0. It uses ElasticNet.

Parameters
  • X – None to use inner quantities

  • update – True to update to the coefficients or False to just return the results

  • alpha – see ElasticNet

  • l1_ratio – see ElasticNet

Returns

dictionary