Updated 3 May 2020
Created to track the simulate the spread of Coronavirus (COVID-19). Case data is obtained over the web and fitted to a logistic model to predict epidemic spread over time.
To operate load the folder containing the script COVID19Modelingv2 and type the following code in the command prompt: COVID19Modelingv2("country").
example: COVID19Modelingv2("US"). Multiple countries can be analyzed at the same time by placing them in a list: COVID19Modelingv2("US","Italy").
The model was created by Milan Batista (fitVirus). The model is a data-driven model that fits epidemic data to a logistic curve. The goal of the model is to make local predictions about the viral spread and epidemic duration. The model can be used to provide accurate approximations in certain situations. "The regression convergence may fail for a pure initial guess or small data set. Therefore the method does not apply to the early stages of an epidemic. Also, results are useless if the regression statistic does not meet minimum criteria, say R^2 > 0.8, p-value < 0.05." (Milan Batista)
DISCLAIMER: Model will fail in certain situations. A rigorous statistical analysis should be performed on all results. The model fails when additional epidemic stages (not described by logistic function) are encountered. Use at your own discretion.
See for more info:
Data is stored online and is provided via JHU CSSE from various sources including:
"The World Health Organization (WHO), DXY.cn. Pneumonia. 2020, BNO News,
National Health Commission of the People? Republic of China (NHC),
China CDC (CCDC), Hong Kong Department of Health, Macau Government, Taiwan CDC, US CDC, Government of Canada, Australia Government Department of Health, European Centre for Disease Prevention and Control (ECDC) and Ministry of Health Singapore (MOH)"
On the figure, the epidemic rate is plotted with a blue line (cases/day). Blue dots are the actual infection rate (cases/day). Region colors separate epidemic transition phases:
red - fast growth phase
yellow - transition to steady-state phase
green - ending phase
Joshua McGee (2023). COVID-19 Modeling (https://www.mathworks.com/matlabcentral/fileexchange/74632-covid-19-modeling), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- Sciences > Biological and Health Sciences >
- AI, Data Science, and Statistics > Statistics and Machine Learning Toolbox > Descriptive Statistics and Visualization >
- Mathematics and Optimization > Optimization Toolbox > Problem-Based Optimization Setup >
- Sciences > Biological and Health Sciences > Epidemiology >
Inspired by: fitVirus
Inspired: Coronavirus Tracker - Country Modeling
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
updated and added notes 4/15
updated with link to in-depth description
-updated graph style
-fixed graphs on the example tab
-fixed plots in example tab
-added more examples
-made script executable as a function
-bug fixes and improvements
-bug fixes and compatibility
-attempted to fix variable name compatibility issues
-fixed all compatibility issues
-fixed predict() function courtesy of Milan Batista
-updated to reflect changes in database
-added graph to visualize stability of total infected estimate (courtesy of Milan Batista)
-ability to run multiple country simulations simultaneously