fitVirusCV19v3 (COVID-19 SIR Model)
This code will retrieve recent data from the HDX and attempt to fit it to a SIR model using structure created by Milan Batista (https://www.mathworks.com/matlabcentral/fileexchange/74658-fitviruscovid19?s_tid=prof_contriblnk). The model is data-driven, so its forecast is as good as data are. Also, it is assumed that the model is a reasonable description of the one-stage epidemic.
Results are saved in structure res (see function fiVirusCV19 header). Optionally the results may be printed by:
fitVirusCV19v3(“Italy",'prn','on')
The plot may be enabled or disabled via (default is on):
fitVirusCV19v3(“Italy",'plt','off')
To plot the growth rate on the figure use (def value is 2)
fitVirusCV19v3("Italy",'nsp',3)
To plot the R0 as a function of time
fitVirusCV19v3("Italy",'r0analysis','on')
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
Joshua McGee (2026). fitVirusCV19v3 (COVID-19 SIR Model) (https://in.mathworks.com/matlabcentral/fileexchange/74676-fitviruscv19v3-covid-19-sir-model), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Sciences > Biological and Health Sciences >
- AI and Statistics > Statistics and Machine Learning Toolbox > Descriptive Statistics and Visualization >
- Sciences > Biological and Health Sciences > Epidemiology >
Tags
Acknowledgements
Inspired by: fitVirusCOVID19
Inspired: fitVirusCV19varW (Variable weight fitting of SIR Model), SIR Model of COVID19 for India with real time tracking
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 3.4.8 | updated 5/2 |
||
| 3.4.7 | updated 5/1/20 |
||
| 3.4.6 | updated 4/30 |
||
| 3.4.5 | updated 4/22 |
||
| 3.4.4 | updated 4/22 |
||
| 3.4.3 | updated info |
||
| 3.4.2 | updated 4/18 |
||
| 3.4.1 | updated 4/17 |
||
| 3.4 | -updated notes and data for 4/15 |
||
| 3.3.9 | updated with link to in-depth description of model |
||
| 3.3.8 | updated 4/15 |
||
| 3.3.7 | updated 4/13 |
||
| 3.3.6 | -updated |
||
| 3.3.5 | -slight bug fixes (error with plotting data that failed to fit the model)
|
||
| 3.3.4 | updated 4/12, introduced the ability to plot changes in R0 over time with 'r0analysis' command |
||
| 3.3.3 | updated 4/11 |
||
| 3.3.2 | -updated 4/10 |
||
| 3.3.1 | updated 4/9 |
||
| 3.3 | -updated 4/8 |
||
| 3.2.9 | -updated (4/6) |
||
| 3.2.8 | -updated |
||
| 3.2.7 | -small fix |
||
| 3.2.6 | -image |
||
| 3.2.5 | -minor updates and corrections |
||
| 3.2.4 | -improved initial parameter approximation (courtesy of Milan Batista) |
||
| 3.2.3 | -updated examples |
||
| 3.2.2 | -updated with data from 4/2 |
||
| 3.2.1 | -image |
||
| 3.2 | -updated 4/1 |
||
| 3.1.9 | -bug fixes |
||
| 3.1.8 | -updated 3/31 8:40 PM EST |
||
| 3.1.7 | -updated aesthetics of examples |
||
| 3.1.6 | -updated examples |
||
| 3.1.5 | -updated plots for today (3/30) |
||
| 3.1.4 | -bug fix |
||
| 3.1.3 | -updated examples |
||
| 3.1.2 | -image |
||
| 3.1.1 | -compatibility notes |
||
| 3.1 | -updated examples |
||
| 3.0 | -updated plots and fixed small bug |
||
| 2.9 | -added death rate to example |
||
| 2.8 | -updated examples |
||
| 2.7 | -added ability to disable plot and created a live script to tabulate the R0 values of each country |
||
| 2.6 | -added Indonesia |
||
| 2.5 | -bug fixes and compatibility |
||
| 2.3 | -compatibility |
||
| 2.2 | -attempted to fix additional variable name Compatability issues |
||
| 2.1 | -compatibility |
||
| 2.0.9 | -fixed all compatibility issues |
||
| 2.0.8 | -bug fixes |
||
| 2.0.7 | -image |
||
| 2.0.6 | -description |
||
| 2.0.5 | -updated date ticks |
||
| 2.0.4 | -new data source (updated database) |
||
| 2.0.3 | -description |
||
| 2.0.2 | -updated compatibility |
||
| 2.0.1 | -updated description |
||
| 2.0 | -applied updates courtesy of Milan Batista (RMSE correction, automatic parameter selection) |
||
| 1.0.4 | -name change |
||
| 1.0.3 | -added tags |
||
| 1.0.2 | -fixed live script |
||
| 1.0.1 | -added live script to generate plots |
||
| 1.0.0 |
