Title: Graph COVID-19 deaths and deaths per million in C#
The previous example showed how to graph COVID-19 cases and cases per million. This example adds the ability to graph COVID-19 deaths and deaths per million.
Recall that the previous example's CountryData class used two arrays of data, Cases and CasesPerMillion, to hold values. When you select one of those data sets, the program stores a reference to the appropriate array in the variable SelectedData and then the program graph that data.
With that much already built, adding new data sets is relatively easy. This example adds the following two arrays to the CountryData class.
public float Deaths = null;
public float DeathsPerMillion = null;
The previous version used a method named LoadCaseData to load the case data. The new version uses a similar method named LoadDeathData to load the death data from a URL that contains that data. The two methods are very similar. Download the examples to see the differences.
Most of the rest of the details are as before. When you select a data set, the program points SelectedData to the appropriate data and graphs it.
I did make one change to the way the program displays the data. When you entered a number in the Align At text box, the previous version aligned the graphs on the day at which the countries first experienced that number of cases. I found that confusing when analysing deaths, so I changed the code to align countries on the selected data. For example, if you set thaht value to 1 and select Deaths Per Million, then the countries are aligned on the first day where they had at least 1 death per million.
US and Others
Here's the picture from the top of the post again.
This graph shows the deaths per million for the four countries with the largest numbers of cases. The most striking result is that the United States has far fewer deaths per million than the others. That's good news for the United States, but it's not clear exactly why. It could be that the US healthcare system is not as overwhelmed as those in Spain and Italy.
It could be that the US is so large that it's taking more time for the virus to penetrate the whole country. The US is big enough that you can think of it as a collection of regions, some of which have been hit extremely hard while others have not yet experienced the full brunt of the pandemic.
For example, New York has experienced around 590 deaths per million, which is significantly more than Spain. Meanwhile California, which implemented restrictions earlier, has experienced only 23 deaths per million.
As with so many things about this virus, time will tell.
In my previous post I talked a bit about the Scandinavian countries. Sweden has imposed relatively loose restrictions, basically relying on healthy people to use their own judgement about social distancing. The graphs of cases and cases per million showed that Sweden has a lot of cases but their cases per million is in line with most of the other Scandinavian countries.
The picture below shows the graph of deaths in Scandinavia.
This graph shows that Sweden has experienced far more COVID-19 deaths than its neighbors; more than three times as many as Denmark. You might ask yourself if the difference is that Sweden has a larger population then the others. The following graph shows that to be false.
Sweden still has roughly twice as many deaths per million as Denmark. It is still possible that differences in reporting or other data artifacts are causing this effect, but it's hard to believe that their loose social distancing program does not play a large part in this. Sweden seems to be sticking to their approach, so time will tell how it all plays out.
The Daily Signal article In Sweden, There's No COVID-19 Lockdown. Here Are 4 Things to Know. provides some interesting information about their policy.
Note that there is a noticeable lag between cases and deaths. That means case data today gives information about deaths later. Today's cases won't become deaths for several weeks. There are some signs that the number of cases is growing more slowly than before, at least in some places, but the numbers of deaths will continue to increase more quickly for a while.
As with all of these COVID-19 examples, download the code and experiment with it. If you find anything interesting, post a note in the comments below.
Download the example to experiment with it and to see additional details.