Updated 13 Jul 2020
The function fits a set of time-delayed logistic curves to data on the Covid-19 epidemic. The size of data limits the number of curves. The model is designed for daily monitoring of epidemic developments and NOT for long-term forecasting. The graph produced is a daily cross-section of the epidemic. For any prediction, it is necessary to monitor the time development of the graph; above all, the final size of the epidemic. The model is phenomenological and is superior to single curves models (SI model, SIR model) in a case when an epidemic drags on.
The function is called by executing the runMe.m function. This function calls data for the world by default. To get data for Slovenia, as an example, you need to change @getDataWorld with @getDataSlovenia in the runMe.m function.
For program options, see fitVirusXXdoc.mlx in the doc folder.
The current data for different countries can be obtained from two sources:
1. run importTotalCases.m function. This function will read data from <https://ourworldindata.org/coronavirus-source-data> and store it in the data folder.
2. run importTotalCasesWM.m function. This function will read data from <https://www.worldometers.info/coronavirus/> and store it in the data folder.
Note 1. The prediction of the model depends on how well the model mimics the course of the epidemic, and on how reliable the data are.
Note 2. The forecast is changed with new or changed data. Forecasts become more reliable towards the end of the epidemic but are unreliable at the beginning.
Note 3. In some situations, the model may fail. In particular, the model may not be suitable for modeling the early stage of an epidemic or the emergence of a new wave. In these cases, we can get unrealistic exponential growth, which usually subsides with new data. If the last wave has exponential growth, then we need to reduce the number of waves or reduce the number of possible susceptible ones (by default, this number is 7e9).
Note 3a. If the number of cases increases rapidly in the last wave, the waveform is narrow, giving the impression that the wave will end soon (the logistic curve is symmetrical with respect to the peak). In this case, it is essential to monitor the daily change in the size of the epidemic before making a conclusion about its duration.
Note 4. The program indicates the start date when the data is sufficient to calculate the initial approximation.
Note 5. By default, the function tries to fit data up to four logistic curves (see 'model' option). It also automatically detects the beginning of the possible next wave by subtracting the limit size predicted by the model from the data. Additional logistic curves fit this extra wave (see 'w3' option).
Note 6. The parameters of the model are obtained by minimization of the objective function, which is the sum of squares for residuals of values. Optimization Toolbox function fminsearch is used to calculate optimal values of unknown model parameters. A quasi-optimal solution is obtained by a heuristic approach. If the calculation fails, then only data are plotted.
Note 7. The model with 4+ waves may be time-consuming. For a sample of 180 data, the elapsed time for the four waves model is about 180 sec.
Note 8. Daily forecasting based on the model are available at
On the epidemic assessment graph, the regions are marked by separate phases of the epidemic (which are not standard, but arbitrarily chosen for convenience):
red - a phase of rapid growth (approx from 12% to 88% of final cases)
yellow - transition to the equilibrium phase (up to 98% cases)
green - final phase (plateau stage)
Daily examples Growth factor graph two rows 1% (green) and 5%
(red) are shown for orientation purposes only.
DISCLAIMER: The software and data are for educational purposes only and not for medical or commercial use. They are provided as they are, and all express or implied warranties, including implied warranties of merchantability and fitness for a particular purpose, are rejected. In some situations, the model may fail. In particular, the model may not be appropriate, or the model may fail at an early stage. Use it at your own discretion.
fitVirusXX is released without support.
milan batista (2023). fitVirusXX (https://www.mathworks.com/matlabcentral/fileexchange/76956-fitvirusxx), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
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.
Add more options for the iteration. Update initial guess function.
Major revision. The number of waves are now limited only by data size. Add function for importing the data from worldmeters.info.
Add 4th wave.
Update 'w3' option. Remove the lower limit for the time delay.
Automatic detection up to 4 waves