File Exchange

image thumbnail

fitVirusXX

version 2.0.3 (7.54 MB) by milan batista
Estimation of coronavirus COVID-19 epidemic evaluation by the summation of logistic models

56 Downloads

Updated 13 Jul 2020

View License

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
<https://www.researchgate.net/publication/339912313_Forecasting_of_final_COVID-19_epidemic_size_200616>

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.

Cite As

milan batista (2020). fitVirusXX (https://www.mathworks.com/matlabcentral/fileexchange/76956-fitvirusxx), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (20)

You could run the fitVirusXX logistic function. If for example you run aa = fitVirusXX(@getDataWorld), then C = logistic(10:100,aa,b) will be a vector of predicted cases for times 10:100.

Adil Majeed

Is there a way that we can convert the generated MATLAB Figure data to excel? If yes then how it can be possible ? Please help

It runs on my computer without any error.

dong gretch

here's the content of runMeXX
close all
addpath('data')
addpath('fitVirusXX')
tic
aa = fitVirusXX(@getDataPhilippines,...
'echo','on','model',4,'ndat',[],'save',1,'jpres','-r300','w3',3);
toc

I don't get any error. Could you display the contents of your runMeXX?

dong gretch

Hi Milan I'm still having this error in the latest version. Can you help how to fix this?
>> runMeXX
Error using fitVirusXX/paramEst2
Method 'paramEst2' is not defined for class 'fitVirusXX' or is removed from MATLAB's search path.

Error in fitVirusXX (line 215)
paramEst2(obj,'echo',echof,'model',model,'ndat',ndat,'nmax',nmax);

Error in runMeXX (line 5)
aa = fitVirusXX(@getDataPhilippines,...

I don't get any error with the current version. I use Matlab R2019b.

SangSup Cho

Thank for your concern. I use the Korea data i.e. aa = fitVirusXX(@getDataSouthKorea,...
'echo','on','model',4,'ndat',[],'save',1,'jpres','-r300','w3',1) and I get the problem.
It seems to me datatime function is something wrong.

Could you specify which function in what data did you try to run?

SangSup Cho

Thank for good fitVirusXX. I get this error. Can you explain how to fix it.
error: fitVirusXX/plot (line 206)
taxis = datetime(datestr(trend + obj.time0));
datetime (line 640)

Version v07 will produce an error if 'w3' option is not 0 or 1. So you change should change 'w3',3 to 'w3',1:
aa = fitVirusXX(@getDataPhilippines,...
'echo','on','model',3,'ndat',[],'save',1,'jpres','-r300','w3',1);

In the current version v08 this problem is fixed, so you can specify up to 3 extra waves searching.

dong gretch

Hi Milan. I have this error. Can you help how to correct this?
Error in runMeXX (line 4)
aa = fitVirusXX(@getDataPhilippines,...

Yes in the case when the epidemic drags on.

ravib1996

Thanks for your effort, really helps to visualize the predictions all around the world. Does this model has better accuracy/RMSE than your previous model (fitVirusCV19)?

The link is not helpful, unfortunately, as it is in another language.

I don't know how one can copyright a mathematical formula, I did not. The copyright is for the program and is inserted by Matlab automatically. Furthermore, the summation of logistic functions is something quite different from the summation of exponential functions (i.e. Fourier series; is it copyrighted?). If there is similar research with logistics and not exponential functions you should mention it explicitly so I could quote it. Anyway, the main idea is about 100 years old:
Lowell J. Reed and Raymond Pearl, On the Summation of Logistic Curves, Journal of the Royal Statistical Society , 1927, Vol. 90, No. 4 (1927), pp. 729-746

Are you the first researcher proposed the idea of using multiple (or three in your given examples) logistic (exponential) function? There is another researcher who suggested and implemented the use of multiple (or three in his preprint) branches of sigmoid (exponential) function published months ago but you have not referred to that work; instead, you gave your "summation method" copyright? The idea of using the summation of three or multiple exponential functions is already copyrighted by someone else. Even if you change the summation equation a little bit as you did, that still requires you to give the previous owners of the main idea all the necessary credits. But, you did not.

Updates

2.0.3

Change image

2.0.2

Add more options for the iteration. Update initial guess function.

2.0.1

Update description

2.0.0

Major revision. The number of waves are now limited only by data size. Add function for importing the data from worldmeters.info.

1.3.0

Add 4th wave.

1.2.0

Update 'w3' option. Remove the lower limit for the time delay.

1.1.2

Minor corrections

1.1.1

Change image

1.1.0

Automatic detection up to 4 waves

1.0.1

Minor corrections

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

fitVirusXX_v13

fitVirusXX_v13/data

fitVirusXX_v13/fitVirusXX

fitVirusXX_v13/fitVirusXX/@fitVirusXX

fitVirusXX_v13/validation