Visualising COVID19
By: Kartikay Laddha
Tags: Data Science, Business Analysis, Coronavirus, Visualization, Covid 19

Visualising COVID19

Analysis of coronavirus from an Epidemic to Pandemic

Photo by Markus Spiske on Unsplash

Coronavirus was first identified in the Wuhan region of China by December 2019 and by March 11, 2020, the World Health Organization (WHO) categorised the COVID-19 outbreak as a pandemic. A lot has happened in the months in between with major outbreaks in Iran, India, the United States, South Korea, Italy and many more countries.

We know that COVID-19 spreads through respiratory droplets, such as through coughing, sneezing, or speaking. But this is an approach to visualise how quickly did the virus spread across the globe and, how did it take the form of a massive pandemic from an outbreak in China!

This is an attempt to visualize COVID-19 data from the first several weeks of the outbreak to see at what point this virus became a global pandemic and finally visualising its numbers across some severely hit nations.

The data used for visualisations have been collected from the publicly available data repository created by Johns Hopkins University’s Center for Systems Science and Engineering. Firstly, we use data till 17th march 2020, for the first several weeks of the outbreak to see at what point this virus became a global pandemic.

A. Importing the Dataset and required Libraries

Loading readr, ggplot2 and dplyr packages in R. Reading the data for confirmed cases from datasets/confirmed_cases_worldwide.csv using read_csv function and assigning. It to the variable confirmed_cases_worldwide.

B. First Glance at the Data by Plotting the Confirmed Cases Throughout the World

The data above shows the cumulative confirmed cases of COVID-19 worldwide by date. Just reading numbers in a table makes it hard to get a sense of the scale and growth of the outbreak. Hence, drawing a line plot to visualise the confirmed cases worldwide.

Using confirmed_cases_worldwide, drawing a ggplot with aesthetics cum_cases (y-axis) versus date (x-axis) and ensuring it is a line plot by adding line geometry. Setting the y-axis label to “Cumulative Confirmed Cases”

C. Comparing China to the Rest of the World

The y-axis in that plot indicated a very steep rise, with the total number of confirmed cases around the world reaching approximately equal to 200,000 by 17th March 2020.

Beyond that, some other things can also be concluded which are; there is an odd jump in mid-February, then the rate of new cases slows down for a while, then speeds up again in March. Early on in the outbreak, the COVID-19 cases were primarily centred in China. Hence, plotting confirmed COVID-19 cases in China and the rest of the world separately to see if it gives us any insight.

Reading in the dataset for confirmed cases in China and the rest of the world from datasets/confirmed_cases_china_vs_world.csv, assigning to confirmed_cases_china_vs_world. Using glimpse() to explore the structure of confirmed_cases_china_vs_world. Drawing a ggplot of confirmed_cases_china_vs_world, and assigning it to plt_cum_confirmed_cases_china_vs_world. Adding a line layer. Adding aesthetics within this layer: date on the x-axis, cum_cases on the y-axis, and then grouping and coloring the lines by is_china.

D. Annotation

We can observe that the two lines have very different shapes. In February, the majority of cases were in China. That changed in March when it really became a global outbreak: around March 14, the total number of cases outside China overtook the cases inside China. This was days after the WHO declared a pandemic.

There were a couple of other landmark events that happened during the outbreak. For example, the huge jump in the China line on February 13th, 2020, wasn’t just a bad day regarding the outbreak; China changed the way it reported figures on that day (CT scans were accepted as evidence for COVID-19, rather than only lab tests).

By annotating events like this, we can better interpret changes in the plot, hence modifying the plt_cum_confirmed_cases_china_vs_world as follows:

E. Adding a Trend Line to Chinese Cases

To get a measure of how fast the number of cases in China grew we need to add a trend line to the Chinese case’s plot. A good starting point was to see if the cases grew faster or slower than linearly.

We can see there is a clear surge of cases around February 13, 2020, with the reporting change in China. However, a couple of days after, the growth of cases in China slows down and to describe the same COVID-19’s growth in China after February 15, 2020 we added this trend line.

Filtering rows of confirmed_cases_china_vs_world for observations of China where the date is greater than or equal to “2020–02–15”, and assigning it to china_after_feb15. Using china_after_feb15, drawing a line plot of cum_cases versus date. Adding a smooth trend line, calculated by using the linear regression method, without the standard error ribbon.

F. Adding a Trend Line to Rest of the World Cases

From the plot above, the growth rate in China is slower than linear. Which indicated that China had at least somewhat contained the virus in late February and early March. Now, similarly comparing the growth of cases across the globe.

Filtering rows of confirmed_cases_china_vs_world for observations of Not China, and assigning them to not_china. Using not_china, drawing a line plot of cum_cases versus date, and assigning it to plt_not_china_trend_lin. Adding a smooth trend line, calculated by using the linear regression method, without the standard error ribbon.

G. Adding a Logarithmic Scale to the Trend for Rest of the World

From the plot above, we can see a straight line does not fit well at all, and the rest of the world cases grew much faster than linearly. Hence, trying to add a logarithmic scale to y-axis to check if the rise is exponential.

Modifying the plot, plt_not_china_trend_lin, to use a logarithmic scale on the y-axis.

H. Countries outside of China which have been hardest hit by COVID19

With the logarithmic scale, we get a much closer fit to the data. From a data science point of view, a good fit is a great news. But unfortunately, from a public health point of view, that meant that cases of COVID-19 in the rest of the world grew at an exponential rate which is quite evident today.

Not all countries are being affected by COVID-19 equally, and it would be helpful to know where in the world the problems were the greatest. Hence, to find the countries outside of China with the most confirmed cases in our dataset; data was imported on confirmed cases by country. Chinese data has been excluded to focus on the rest of the world.

Looking at the output of glimpse() to see the structure of confirmed_cases_by_country and Using confirmed_cases_by_country, we group by country. Summarising to calculate total_cases as the maximum value of cum_cases. And getting the top seven rows by total_cases.

I. Plotting the Hardest Hit Countries as of Mid-March 2020

Even though the outbreak was first identified in China, there is only one country from East Asia (South Korea) in the above table. Four of the listed countries (France, Germany, Italy, and Spain) are in Europe and share borders. To get more context, we can plot these countries’ confirmed cases over time.

Reading in the dataset for confirmed cases in China and the rest of the world from datasets/confirmed_cases_top7_outside_china.csv, and assigning it to confirmed_cases_top7_outside_china and Using glimpse() to explore the structure of confirmed_cases_top7_outside_china. Using confirmed_cases_top7_outside_china, drawing a line plot of cum_cases versus date, grouped and colored by country and setting the y-axis label to “Cumulative Confirmed Cases”.

J. Plotting the Hardest Hit Countries as of Today

Now in order to analyse the hardest-hit countries. As of today, we will have to import fresh data which is updated till today i.e 28th June 2020, hence we use coronavirus library from Github (Dev) version which is updated on a daily basis.

Conclusion

From the above analysis, we can conclude the timing and the shift in the virus from being an Epidemic in Wuhan, China to becoming a World crisis Pandemic. We can also observe a significant increase in the. Rise of cases in China. After mid-Feb due to improvement in tests and also considering CT Scans as a test for Corona Virus. Also, using a regression trend we can clearly see the exponential rise of the cases across the world and atlas we can visualise the countries which are severely hit by the virus in today’s time. This has been an effective way to study the growth in the number of cases across the world and especially in china through Visualisations in R using read, gig-lot and dplyr libraries.

Looking at India in specific, it ranks 4th currently in the number of confirmed cases and it is very correct to state that the number of cases is increasing day by day and even though the government is being negligent and removing the lockdown, one must keep in mind that the virus has not been eradicated and he/she should vitally maintain the social distancing norms with giving utmost priority to one’s hygiene.