fitVirusCOVID19

Estimation of coronavirus COVID-19 epidemic evaluation by the SIR model
5.5K Downloads
Updated 12 May 2020

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

The function fitVirusCV19 implements the susceptible-infected-removed (SIR) epidemic model for the estimation of epidemy evaluation. It is assumed that the model is a reasonable description of the one-stage epidemic. In particular, the model assumes a constant population, uniform mixing of the people, and equally likely removalof infected. The model is data-driven, so its forecast is as good as data are. The forecasting change with new or changed data. The officially declared outbreak of the epidemic and the outbreak of the epidemic as it reported by the program have nothing to do with each other. The program indicates the start date when the data is sufficient to calculate the initial approximation.

For those who are not familiar with epidemic models, we suggest the following articles: https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiolog,
http://www.maths.usyd.edu.au/u/marym/populations/hethcote.pdf , and https://web.stanford.edu/~jhj1/teachingdocs/Jones-on-R0.pdf.

The parameters of the model are obtained by minimization of the objective function, which is the sum of squares for residuals of values and sum of squares for residuals of values differences. The weights of summands are selected automatically. Optimization Toolbox function fminsearch is used to calculate optimal values of unknown model parameters. If the calculation fails then only data are plotted.

The contribute contains data for coronavirus for Argentina, Austria, Belgium, Brazil, Canada, Croatia, China, Czech Republic, Denmark, Germany, Hungary, France, Iceland, India, Indonesia, Iran, Italy, Japan, Netherlands, Norway, Poland, Portugal, Romania, Russia, Slovakia, Serbia, Slovenia, South Korea, Spain, Switzerland, Turkey, UK, USA and World (up to 28.April.2020)

On the epidemy evaluation graph, regions color separate epidemy phases (these are not standard but arbitrarily chosen for convenience):
red - fast growth phase
yellow - transition to steady-state phase
green - ending phase (plateau stage)

On the total cases graph, margins are +/-3*RMSE; on daily new cases graph, margins are +/dRMSE.

On Daily Cases Growth Factor graph two lines 1% (green) and 5% (red) are shown only for orientation reason.

Results are saved in structure res (see function fiVirusCV19 header). Optionally the results may be printed by

fitVirusCV19(@getDataXXX,'prn','on')

where XXX stands for the country name. When regression fails then only data are plotted. Population size is limited to 12 Mio. You can change the upper limit by name/value pair:

fitVirusCV19(@getDataXXX,'nmax',nmax)

Use this option if the final prediction is too high or exceed the country's population.

To exclude growth rate from the graph on the figure use (def value is 3)

fitVirusCV19(@getDataXXX,'nsp',2)

Function analyseCV plots a graph of evaluation of contact number (sigma), Cend (epidemic size), N (initial susceptible population size). To analyze data for country XXX from 10 days of epidemic onward use

analyseCV19(@getDataXXX,10)

DISCLAIMER: Software and data are for education and not for medical or commercial use. The model may fail in some situations. In particular, the model may be inadequate; the model may fail in the initial phase and in when additional epidemic stages or outbreaks (not described by SIR model) are encountered. Use it at your own discretion.
The data are only for demonstrating the operation of fitVirusCV19. FitVirus and presented demo data are only for educational and academic purposes and should not be used for medical purposes and in commerce. They are provided as is and any express or implied warranties, including but not limited to implied warranties of merchantability and fitness for a particular purpose are disclaimed.

Source of data
https://ourworldindata.org/coronavirus-source-data.
https://www.worldometers.info/coronavirus/coronavirus-cases/#case-tot-outchina
https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic_by_country_and_territory
An actual source of data is for each country reported in the corresponding getData function.

NEW: importTotalCases function read and generate data from <ourworldindata> data file (by Igor Podlubny )

A more detailed description can be found in
https://www.researchgate.net/publication/339311383_Estimation_of_the_final_size_of_the_coronavirus_epidemic_by_the_SIR_model
Examples can be found in
https://www.researchgate.net/publication/339912313_Forecasting_of_final_COVID-19_epidemic_size_200318

Cite As

milan batista (2024). fitVirusCOVID19 (https://www.mathworks.com/matlabcentral/fileexchange/74658-fitviruscovid19), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

fitVirusCV19_v07_v18

fitVirusCV19_v07_v18/CV19

fitVirusCV19_v07_v18/PLA

fitVirusCV19_v07_v18/data

Version Published Release Notes
5.2.1

Minor changes

5.2.0

Add function fitVirusCV19R which treats the daily case as newly removed cases and not newly infected cases.

5.1.0

Add 'tick' option to control x-axis ticks and 'data' option to display all data (see readMe.m for usage). Correct Daily New Cases shift to +1 day (thanks to Burak). Change analysisCV19: now the number of days is days back from the current date.

5.0.3

Update description. Change recovered with removed.

5.0.2

Minor corrections. Add statistics of daily new cases.

5.0.1

Add parameters plot to analyseCV19. Add importTotalCasesR15 for those who only have MATLAB R2015a (thanks to Sherwood Samn)

5.0.0

Correct NaN cases. Change plot range. Add calculation of epidemic end (5 cases left)

4.3.6

Correct report

4.3.5

Trim data for some countries (India, Indonesia, Argentina, Croatia)

4.3.4

Trim data for some countries

4.3.3

Minor corrections.

4.3.2

Change image

4.3.1

The update suggested by Yusuf Kursat Tuncel to display correct date and value. Add version fitVirusCOVID19cs which change graph x axis to datetime values (thanks to Christian Schiffer).

4.2.1

Update description

4.2.0

Add function impoertTotalCases that automating the download of the data
on the total COVID-19 cases from <ourworldindata.org> (thanks to Igor Podlubny )

4.1.4

Update data. Add R0 > 1 (basic rep. number) and R <= R0 (rep. number) to title and analyze function.

4.1.3

update of USA data in PLA folder ( by Patrick Anderson). Minor corrections.

4.1.2

Minor corrections

4.1.1

Correct fitVirusCV19 to support calcR0. Update data for Japan.

4.1.0

Add an optional graph of growth rate. Update data (4.4.2020)

4.0.9

Update description

4.0.8

Minor corrections

4.0.7

Update data. Change graph text: now its contains contact number, contact time and infectious time. Add function to calculate R0.

4.0.6

Change image

4.0.5

update regression algorithm. By default, the solution with min N is selected (optimistic approach). Add Iceland and Sweden. Update data (2.4.2020)

4.0.4

Change image

4.0.3

More minor changes

4.0.2

Minor corrections

4.0.1

Add the check data folder (thanks to Rolf Boelens). Add two utility programs in folder PLA (thanks to Patrick Anderson)

4.0.0

Major revision. Add flambertw for those who have no SMTbx. Add importData function.

3.0.6

Update description

3.0.5

Update description

3.0.4

Update description

3.0.3

Update analyseCV19

3.0.2

More minor corrections

3.0.1

Minor corrections

3.0.0

Add analyseCV19. Update data, add Czech Republic, Japan, Slovakia

2.0.05

Change image with today predictions in Lombardia

2.0.04

Improve initial data trim. Add data for Brazil, India, and Poland.

2.0.03

Correct description

2.0.02

Add address of data source

2.0.01

Add data for Canada (thanks to Remy Boisse) , Indonesia (thanks to Maldiku Servinu) and Serbia. Upgrade description.

1.0.14

Update description

1.0.13

Update description

1.0.12

Update data. Add Hungary and NY State

1.0.11

Correct data

1.0.10

Add new data

1.0.9

Add data for NYState. Add the option for controlling the number of iterations.

1.0.8

Add data for Denmark and Norway. Data are now automatically trimmed. Weights are now selected automatically. Minor corrections.

1.0.7

Delete duplicate examples

1.0.6

Minor corrections. Add data for Croatia and UK

1.0.5

Correct graphs

1.0.4

Minor corrections

1.0.3

Correct description

1.0.2

Improve print and initial guess function. Add data for Lombardia.

1.0.1

edit description

1.0.0