In this repo we consider the SIR model simulating the spread of disease in Octave.
The name SIR comes from the three epidemiological population classes we are considering:
- S — Susceptible are healthy individuals which can be infected in the future.
- I — Infected are individuals which are carrying the infection and can infect others.
- R — Removed are those who were infected and now can't spread the disease anymore.
Let's consider the parameters of the model. The numbers of members in every epidemiological class at the moment t are S(t), I(t) and R(t). If the total population is N, we have S(t) + I(t) + R(t) = N. Moving between classes is only possible according to the pattern S → I → R.
Script calculates relevant values and plots figures.
The script requires signal package. To install the package, in octave execute:
$ pkg install -forge signal
$ git clone https://github.com/StokicDusan/SIRmodel.git
$ cd SIRmodel/
In the command line simply invoke the script with:
$ octave --persist SIR.m
$ octave --persist SIR-mi.m
The following code block shows an example of calling SIR.m and SIR-mi.m scripts from terminal explained in the launch section.
% SIR.m
maxI = 0.24107
Tstar = 85
Rinf = 0.89911
Peaks of prevalence by days are:
0.24107
85.00000
% SIR-mi.m
maxI = 0.23612
Tstar = 87
Rinf = 0.56549
Peaks of prevalence by days are:
0.236122 0.049804 0.027671 0.022386 0.020844 0.020363 0.020209
87.000000 405.000000 686.000000 965.000000 1244.000000 1523.000000 1802.000000
Descriptions of values shown in code blocks above are given below.
Variables | Description |
---|---|
N | The total population at the begining of the simulation |
maxI | Infected population at the peak of the epidemic normalized by N |
Tstar | Time where the epidemic reaches its peak in days |
Rinf | Removed population after the epidemic normalized by N |
Apart form outputs to the terminal the scripts plot figures. All four figures calling SIR.m script are given below (more plots can be found in the assets folder):
If you encounter any bugs or have suggestions, please file an issue in the Issues section of the project.