---
---

<link rel="stylesheet" href="styles.css" type="text/css">

<span id="Initial"><br><br></span>

# <span><a href="#Plan">[&nabla;]</a></span> <span><a href="#Final">[@]</a></span> <span style="color: red;">Introduction aux modèles épidémiologiques décrits dans Wikipédia</span>

### Version 2020-10-18
### Licence cc-by-sa ModLibre.info sauf autres indications


#### NB : Copiez les instructions que vous voulez tester dans une version récente de Python

<span id="Plan"><br><br></span>

# <span><a href="#SIR">[&nabla;]</a></span> <span><a href="#Initial">[&Delta;]</a></span> <span style="color: red;">Plan de l'introduction aux modèles épidémiologiques décrits dans Wikipédia</span>

* [<STRONG>Modèle SIR de Kermack et McKendrick</STRONG>](#SIR)
* [<STRONG>Modèle SIR en deux dimensions</STRONG>](#SIR2D)
* [<STRONG>Diagrammes d'interactions</STRONG>](#Interactions)
* [<STRONG>Modèle SIR programmé en Python</STRONG>](#SIR-Python)

<span id="SIR"><br><br></span>

# <span><a href="#SIR2D">[&nabla;]</a></span> <span><a href="#Plan">[&Delta;]</a></span> <span style="color: red;">Modèle [SIR](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie) de <span style="color: green;">_Kermack_</span> et <span style="color: green;">_McKendrick_</span></span>

<img src="images/SIR_model_anim_0760x0600_cc-by-sa_WM.gif" style="width:70%; border:0px solid; margin-right: 0px" align="center">

### <span style="color: blue;">Sains </span> &nbsp;&nbsp;&nbsp; <span style="color: orange;">Infectés </span> &nbsp;&nbsp;&nbsp; <span style="color: green;">Résistants</span>

### Merci à [<span style="color: green;">_Phrontis_</span>](https://commons.wikimedia.org/wiki/User:Phrontis) pour ce [modèle](https://de.wikipedia.org/wiki/SIR-Modell#/media/Datei:SIR_model_anim.gif).

### Références : 

* [Modèles compartimentaux en épidémiologie](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie)
* [Compartmental models in epidemiology](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology)
* [Kermack–McKendrick theory](https://en.wikipedia.org/wiki/Kermack%E2%80%93McKendrick_theory)
* [Mathematical modelling of infectious disease](https://en.wikipedia.org/wiki/Mathematical_modelling_of_infectious_disease)


<span id="SIR2D"><br><br></span>

# <span><a href="#Interactions">[&nabla;]</a></span> <span><a href="#SIR">[&Delta;]</a></span> <span style="color: red;">Modèle [SIR](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie) en deux dimensions</span>

<img src="images/SIR_model_simulated_using_python_0800x0600_by-sa_WM.gif" style="width:100%; border:0px solid; margin-right: 0px" align="center">

### <span style="color: blue;">Sains </span> &nbsp;&nbsp;&nbsp; <span style="color: green;">Infectés </span> &nbsp;&nbsp;&nbsp; <span style="color: red;">Résistants</span>

### Merci à [<span style="color: green;">_Beta212_</span>](https://commons.wikimedia.org/wiki/User:Beta212)</span> pour ce [modèle](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#/media/File:SIR_model_simulated_using_python.gif) écrit en Python.
### Références : 

* [Compartmental models in epidemiology](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology)
* [Epidemic models on lattices](https://en.wikipedia.org/wiki/Epidemic_models_on_lattices)


<span id="Interactions"><br><br></span>

# <span><a href="#SIR-Python">[&nabla;]</a></span> <span><a href="#SIR2D">[&Delta;]</a></span> <span style="color: red;">Diagrammes d'interactions</span>

<img src="images/SIR_TwoPopulations_0397x0684_cc-by-sa_WM.png" style="width:30%; border:0px solid; margin-right: 0px" align="center">

### Merci à [<span style="color: green;">_Philippe Giabbanelli_</span>](https://commons.wikimedia.org/wiki/User:Philippe_Giabbanelli)</span> pour ce [diagramme](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie#/media/Fichier:TwoPopulations.png) d'[interactions](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie).

### Références : 

* [Modèles compartimentaux en épidémiologie](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie)


<span id="SIR-Python"><br><br></span>

# <span><a href="#Final">[&nabla;]</a></span> <span><a href="#Interactions">[&Delta;]</a></span> <span style="color: red;">Modèle [SIR](https://fr.wikipedia.org/wiki/Mod%C3%A8les_compartimentaux_en_%C3%A9pid%C3%A9miologie) programmé en Python</span>

<img src="images/SIR_Python_20_20D03Q03_1400x0900c.png" style="width:90%; border:0px solid; margin-right: 0px" align="center">

```{Python}
# coding: utf-8             Autorise les accents
# © Copyright 2018...       Jared GERSCHLER http://jaredgerschler.blog/ 
# Acknowledgements          Jared GERSCHLER http://jaredgerschler.blog/ 

import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt

# total population
N = 5000
# initial infected
I0 = 6
# initial recovered
R0 = 0
#initial susceptible
S0 = N - I0 - R0

# contact rate
beta = 0.3
# mean recovery rate
gamma = 0.1

# initial conditions vector
y0 = S0, I0, R0
# 200 evenly spaced values (representing days)
t = np.linspace(0, 200, 200)

def func(y, t, N, beta, gamma):
    # S, I, R values assigned from vector
    S, I, R = y
    # differential equations
    dSdt = -beta * S * I / N
    dIdt = beta * S * I / N - gamma * I
    dRdt = gamma * I
    return dSdt, dIdt, dRdt

# Integrate the diff eqs over the time array
values = odeint(func, y0, t, args=(N, beta, gamma))
# assign S, I, R values from values transpose
S, I, R = values.T

fig = plt.figure()
ax = fig.add_subplot(111, axisbelow=True)
ax.plot(t, S, 'black', lw=1.5, label='Susceptible')
ax.plot(t, I, 'orange', lw=1.5, label='Infected')
ax.plot(t, R, 'blue', lw=1.5, label='Recovered')
ax.set_xlabel('Time (days)')
ax.set_ylabel('Number of People')
ax.set_ylim(0,5100)
ax.set_xlim(0,200)
ax.grid(b=True, which='major', c='#bbbbbb', lw=1, ls='-')
legend = ax.legend()
legend.get_frame().set_alpha(0.5)
plt.show()
```
### Merci à [<span style="color: green;">_Jared GERSCHLER_</span>](http://jaredgerschler.blog/)</span> pour ce programme écrit en Python.


<span id="Final"><br><br></span>

# <span><a href="#Initial">[@]</a></span> <span><a href="#SIR-Python">[&Delta;]</a></span> <span style="color: red;">Fin</span>


***
##### [2021-03-13 &nbsp;&nbsp;&nbsp; © 2020-2021 ModLibre.info](http://modlibre.info) &nbsp;&nbsp;&nbsp; [licence cc-by-sa](http://creativecommons.org) &nbsp;&nbsp;&nbsp; [Source](epidemie.Rmd) &nbsp;&nbsp;&nbsp; [W3C](http://validator.w3.org/) &nbsp;&nbsp;&nbsp; [HTML5](https://fr.wikipedia.org/wiki/HTML5) &nbsp;&nbsp;&nbsp; [CSS](http://jigsaw.w3.org/css-validator/)
***
