Simple statistical analysis for Covid-19 data




Work done by Mehdi CHEBBAH.


Table of Contents

Working environment


Anaconda is a utility for Python offering many features. It offers for example the possibility to install libraries and to use them in its programs, but also offers software to help developers to set up a complete development environment quickly.


Spyder (named Pydee in its first versions) is a development environment for Python. Free (MIT license) and multi-platform, it integrates many libraries for scientific use Matplotlib, NumPy, SciPy and IPython.


Scikit-learn is a free Python library for machine learning. It is developed by many contributors, especially in the academic world by French higher education and research institutes like Inria and Télécom Paris. It includes functions for estimating random forests, logistic regressions, classification algorithms, and support vector machines. It is designed to harmonize with other free Python libraries, notably NumPy and SciPy.


Matplotlib is a library of the Python programming language for plotting and visualizing data in graphical form. It can be combined with the NumPy and SciPy6 scientific computing python libraries. Matplotlib is distributed free and free under a BSD style license. Its current stable version (the 2.0.1 in 2017) is compatible with Python version 3.


Statistical study

We are going to use these libraries which will facilitate our task

Basic study

In this section we will use the data set detailed-cases.csv which contains data on more than 800 cases collected between 13/01/2020 and 09/02/2020 in China, Hong Kong, Japan, Singapore, South Korea and other countries.

we first want to estimate the age of the people likely to get sick with this pandemic. To do this

It can be seen that more than 50% of the infected are between 35 and 65 years old and that the average age is 53.

We now want to study the effect of gender on the distribution of cases

Therefore, the distribution of the infected between the two sexes in relation to age is practically equal.

Thus, in relation to the number of deaths, more than 50% of male deaths are between 60 and 80. However, 50% of female deaths are between 67 and 82.

We notice that the percentage of deaths is lower than 10%.

So the symptoms that appear on most COVID-19 infected people are: Fever, Dry cough, Dyspnea, Fatigue, Diarrhea, Sickness, Irritated throat.

The tendency of the evolution of the pandemic

For this part we will use the data set that exists in this repo-Github that contains the data of the global cumulative evolution of COVID-19 (world-aggregated.csv), the cumulative evolution in each country (countries-aggregated. csv), a comparison between the countries most affected by this pandemic (key-countries-pivoted.csv) and details about the United States (us_confirmed.csv and us_deaths.csv) - we will not study the case of the United States -.

We will use the data set worldwide-aggregated.csv.

for the evolution of the number of suspected cases, deaths and recovered cases

The evolution in Algeria

In-depth study

We will be using these libraries to make our task easier

Linear regression

We want to do a linear regression to try to predict the number of suspected cases and the number of deaths as a function of time. To do this we need to go through a preprocessing of the data.

Note that it's impossible to predict the number of cases depending only on time (There are a tons of parameters that controles the spreading of the pandemic). But just for the sake of the tutorial we will do this. Because our goal is to learn how to apply a simple Machine Learning algorithm to our dataset.

It can be seen from the graphical representations of these two variables that a simple linear regression cannot be a good prediction model.


Model for predicting the number of deaths

We would like to do a regression based on the number of cases and time, as we can do with the number of confirmed cases only, and we can also do a regression of the number of deaths against time and compare the results

Time-only based


For the R2 value

Based on the number of confirmed cases

For the R2 value

Based on time and number of confirmed cases

For the R2 value

We notice that the third model is the best with respect to the value of R2


The regression model is incapable of predicting correct results in the future. Indeed, the evolution of the pandemic does not depend on time only, but there are other factors that help or brake its propagation, for example the degree of quarantine application, the percentage of confirmed cases in relation to the total population, the density of infected wilayas and other factors.

However, in order to design a good quality model, a large amount of good quality data is needed. In addition, it is necessary to choose another model because I think that the evolution of this pandemic is not linear and cannot be modeled by a linear model.

We can do the modeling by a SVR algorithm (Support Vector Regression) or a polynomial regression or by using decision trees hoping that the results will be better adapted to the context of this pandemic.

Bibliography & Webography

  1. (fr)
  2. (fr)
  3. (fr)
  4. (fr)
  5. Le nombre de nouvelles cas par jour (en)
  6. Le nombre de cas cumulee (en)
  7. La liste détaillés des individues infectées (en)