- Prediction algorithm used
- Source codes:Daily-data predictor | Moving-average predictor
- Database (Text files compiled from this site)

This utility is best suited to Linux platforms, because it uses xfig images. Suppose that you want to plot the curves for Foobar Pradesh. Follow these steps. Let us first look at the daily-data predictor.

- Download the C source file, and store it in a directory.
- Create two subdirectories with the names
db(for input) andres(for output).- Select a short name (like FB) for your region. This need not be a two-letter word. But avoid long names.
- Create a database file
db/FB.dat. See the sample database files to understand the format. The first line stores the full name of your region (Foobar Pradesh). This is followed by lines each containing a date and the number of new cases on that date. The program assumes that the dates are contiguous and appear in the increasing order. Skipped dates will yield outputs not necessarily meaningful. Populate the database file by data from an authentic source (like this).- The code has two modes of operation. If you want to find the estimates based on a number of days (like 30) that you would explicitly specify, do the following.
If the predictor does not fail on these values, a filegcc -Wall predictor.c -lm

./a.out FB 30res/FB30.figwill be created.If you want the predictor to supply you the best-fit curves, do the following.

Except in extreme situations, this would work, and two files will be created:gcc -Wall -D_BESTFIT predictor.c -lm

./a.out FBres/FBBF.fig(best fit, daily cases) andres/FBCM.fig(best fit, cumulative).- You can open fig files using the xfig utility. For converting to jpeg, you may run xfig as:
But you have to export to jpeg (or any other supported format) manually. If you want to convert fig files to jpeg files from the command line, use the following.xfig -exportL jpeg -export_m 20 -jpeg 95 -smooth_factor 4 res/FBCM.figfig2dev -L jpeg -b 20 -m 1.25 -S 4 -q 95 res/FBBF.fig res/FBBF.jpgUsing the moving-average predictor is similar. Download the source code, and store in some directory. If you want to get

w-day moving-average predictions, create a subdirectorymaw. The pictures are dumped there. You should preferably take an odd value ofw. Here is an example with 5-day moving averages.mkdir ma5

gcc -Wall movavg-predictor.c -lm

./a.out FB 30 5

gcc -Wall -D_BESTFIT movavg-predictor.c -lm

./a.out FB 5

fig2dev -L jpeg -b 20 -m 1.25 -S 4 -q 95 ma5/FB30.fig ma5/FB30.jpg

fig2dev -L jpeg -b 20 -m 1.25 -S 4 -q 95 ma5/FBBF.fig ma5/FBBF.jpg

fig2dev -L jpeg -b 20 -m 1.25 -S 4 -q 95 ma5/FBCM.fig ma5/FBCM.jpg

- Initial mottivation (The SUTD page on Predictive Monitoring)
- The logistic model and the SIR model (Paper by Milan Batista)
- A matlab code for the SIR model (by Milan Batista)
- The logistic model (Wikipedia)
- The SIR model (Wikipedia)
- Nonlinear least-square regression (Wikipedia)

The logistic model and the nonlinear regression method are theoretically perfect. But the real-life data is too noisy to fit the theory gracefully. It is evident that no meaningful predictions can be obtained from these experiments. I am clueless how or whether more reliable predictions can be made possible.The concept of best-fit curves is based on the minimization of the root-mean-square error. The minimum is taken over all values of

Nin the range 30 to the total number of days for which data are available.In order to smooth out daily fluctuations without sacrificing tracking the trend, the idea of moving averages is implemented. An odd-length window is used. The average is assigned to the central day of the window. Therefore the predictions for (2

k+ 1)-day moving-average method is actuallykdays old although it partially incorporaates the data for the lastkdays. The daily-data predictions are essentially 1-day moving-average predictions.The fixed-day predictions will no longer appear in this page. Only the best predictions will show. If needed, fixed-day data can be generated from the source codes.

These curves should not be considered as time-invariant. They evolve as more and more new data points are available. The predictions of today may be significantly different from what the program will do after a week (since seven new data points will be available by then). This model does not capture (neither does the SIR model) population size, density, mobility, age distribution, and so on. All these factors are clubbed together in a single parameter called the infection rate.

This is a free-lancing activity conducted soley by me, so far. Constructive suggestions are very welcome.