COVID-19 growth modeling and forecasting in Pakistan provinces with python

Piotr Krosniak
3 min readApr 12, 2020

Logistic Growth is a mathematical function that can be used in many scenarios, including forecasting growth of COVID-19 cases. Logistic Growth is characterized by increasing Growth in the beginning period, but a decreasing growth at a later stage, as you get closer to a maximum. For example, in the COVID-19 situation, this maximum limit would be the total number of people in the world or country, because when everybody is sick, Growth will diminish.

Epidemiolocal studies confirm that in the first period of an epidemic follows Exponential Growth and that the total period can be modeled with a Logistic Growth. In other words, at the begging, we observe a large number of cases and high Growth, but when we look at the number of cases after the Logistic epidemic, growth is more accurate to predict the number of cases over time.

We can also identify if the virus in a particular administrative unit (country, province) is still growing exponentially or Growth starts to follow a flat curve. Virus spread can be modeled by logistic function. If an administrative unit is in the second part of the function, this means Growth is going towards the end, if somewhere in the middle — this means fast Growth is still ahead.

1. When the fastest growth day is still ahead = growth increasing (phase 1).

2. When the fastest growth day is in the past = growth stabilized (phase 2).

In the case of Pakistan, we analyze first the data for the entire country and then for provinces separately, a large number of cases is concentrated in specific parts of the country, and the size of the country, and also restrictions in the movement have an impact on the number of cases.

For Pakistan number of cases is expected to increase, and the country is currently in the growth increase (1) phase. The total number of cases is expected to reread around 9000, and we can expect a peak around begging of May and stabilization in the second half of May 2020.

Now let’s look at major provinces around Pakistan with a substantial number of cases that will enable us to run the forecast.

Punjab province

In Punjab province, the Growth based on the number of cases is increasing (phase 1) the number of cases is expected to reach 8500, and we can expect that situation will stabilize in the second half of May 2020.

Sindh province

The situation in Sindh is different than in Punjab number of cases is stabilizing and should reach around 1100 cases. Also, a number of new cases should stabilize and reach a maximum of around the second half of April.

Important to remember that forecast, it is based on today’s actual numbers, with next day data situation can change.

You can find code and data on my Github page https://github.com/PiotrKrosniak/covid19-growth-modeling

References and inspirations:

Note from the editors: Towards Data Science is a Medium publication primarily based on the study of data science and machine learning. We are not health professionals or epidemiologists, and the opinions of this article should not be interpreted as professional advice. To learn more about the coronavirus pandemic, you can click here.

--

--

Piotr Krosniak

DataScience and #GIS specialist. Love #triathlon #dataviz and #opensource tech. Dad of two work in UNICEF