Hello, Habr! About a month ago, I had a feeling of constant anxiety. I began to eat poorly, sleep even worse, and constantly read to a ton of news about the pandemic. Based on them, the coronavirus either captured, or liberated our planet, was either a conspiracy of world governments, or the vengeance of the pangolin, the virus either threatened everyone at once, or personally me and my sleeping cat… Hundreds of articles, social media posts, youtube-telegram-instagram-tik-tok (yes, I sin) content of varying degrees of content quality did not lead me to anything but an even greater sense of anxiety. But one day I bought buckwheat decided to end it all. As soon as possible! I needed a plan of action a little more meaningful than the one I had before.
All I had to do was find the data. Reliable, complete, and up-to-date. To my relief, this proved to be much easier to do than I had imagined when I realized the task. My (not) great plan: After a month from the date of forming the plan, I found at least one definite plus — it turned out to be feasible. And the mission was completed! So I was at the next stage – independent analysis of the situation. It quickly became clear that very often the approaches used did not suit me for a number of reasons, which are discussed below. Uploading COVID-19 spread data: Uploading data about the population of countries: Предобработка данных: Plot settings: Issue: absolute number of cases as a key indicator. Motivation: if we take the absolute number of cases, then a village where 50 out of 100 people got sick is hundreds of times better than Rome (for example) in terms of the epidemiological situation. Solution: display the percentage of the population of the country (city) that has the disease. We will conduct an experiment: we will plot the dependence of the number of infected people over time.  In countries that do not have many cases, it is impossible to make out anything: no growth, no decline, and even more so, the tipping points in the pandemic population of the country. Let’s do logarithmic scale the number of cases, hoping to see something, but it will become as if everyone has about 100K diseases.  Now it is the same, only with the number of sick people per 1 million of the population.  And the same thing on a logarithmic scale:  I think it is not necessary to indicate how much better the "quiet" harbors and countries where the epidemiological situation is not so calm have become visible. Issue: when comparing the epidemiological situation, there is used the date of the first COVID infected case in the country as a reference date. Motivation: a) the effect of a low base (there was one case, it became 3, total growth +200%); b) we miss the moment when the epidemic in the country took on a pandemic; 3) it is hard or even impossible to compare the speed of spread between countries. Solution: we use the dates when >1 infected per million of the country's population, >0.1 dead per million of the population, as the reference date. Similarly, let's look at the dynamics of increasing the number of cases of the disease, starting with the first detected case.  Let's plot the dynamics of the increase in the number of cases per 1 million population, starting from the moment when we had at least 1 infected per million population.  China and South Korea have significantly dropped, the trend in Russia is growing, and trends for "calming" the situation in Italy and the United States are visible. Issue: a forecast is based on the number of infected people to solve the problem "when it's all over". Motivation: the recovered patients and the fatal cases will no longer infect anyone, no one will go to the hospital because of them. Solution: we make forecasts based on the number of active cases (infected cases minus the sum of fatal and recovered cases). Let's build a plot where we will display infected cases, recovered, fatal, and the number of active cases (blue line).  The graph shows how important information about the number of active cases is for a full understanding of the development of the epidemiological situation in the corresponding camp. Issue: the number of infected cases today is just a record of the fact that it was at least a week ago (probably about 10 days ago [I don't know how to calculate this figure]). Solution: modeling based on data from a week ago, checking the prediction for today; searching for insights (for example, the ratio of the number of cases found on a day to the number of tests made on that day). There is probably no simple solution here. Let's try using the ARIMA autoregression model to look a week ahead:  Switzerland and Belgium demonstrate an amazing turnaround in the fight against COVID-19, Portugal is not much better than the United States, and Russia has a poor chance of growing faster than many Europeans, which are shown on the chart. Let's compare 2 approaches for assessing and predicting the development of the epidemiological situation in the country. Number of cases by time (naive approach):   Density of cases in the population to the number of days after 1 case of infection per 1 million population (the approach described in this post):  Compare approaches and find your way :) 
You can to reproduce the result, experiment with other countries, dig into the source code, make a pull-request [in this repo] (https://github.com/codez0mb1e/covid-19/blob/master/src/covid-19-yaaa.Rmd). 
Take care of yourself! ML Preacher, Cloud Architect && Coffee Addicted