COVID-19 Analysis
In[]:=
In[]:=
DateString[]
Out[]=
Tue 9 Mar 2021 09:11:09
Download global data
In[]:=
If[Not[ValueQ[wdata]],wdata=SemanticImport["https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv"]];(*Keys[wdata[1]]*)
Characteristics of the data
In[]:=
attributes=Length[wdata[1,All]]rows=Length[wdata[All,1]]
Out[]=
59
Out[]=
73384
Extract the data for Australia, Brazil and the USA from the global dataset
In[]:=
UScases=wdataSelect#location&,{"date","new_cases"};BRcases=wdataSelect#location&,{"date","new_cases"};AUcases=wdataSelect#location&,{"date","new_cases"};USdeaths=wdataSelect#location&,{"date","new_deaths"};AUdeaths=wdataSelect#location&,{"date","new_deaths"};BRdeaths=wdataSelect#location==&,{"date","new_deaths"};UStests=wdataSelect#location&,{"date","new_tests"};AUtests=wdataSelect#location&,{"date","new_tests"};BRtests=wdataSelect#location&,{"date","new_tests"};
Plot new cases per day
In[]:=
plotAUcases=DateListPlot[{AUcases},PlotRangeAll,PlotLabel"New Covid-19 Cases per day - Australia"];plotUScases=DateListPlot[{UScases},PlotRangeAll,PlotLabel"New Covid-19 Cases per day - USA"];plotBRcases=DateListPlot[{BRcases},PlotRangeAll,PlotLabel"New Covid-19 Cases per day - Brazil"];
Plot deaths per day
In[]:=
plotUSdeaths=DateListPlot[{USdeaths},PlotRangeAll,PlotLabel"Covid-19 Deaths per day - USA "];plotAUdeaths=DateListPlot[{AUdeaths},PlotRangeAll,PlotLabel"Covid-19 Deaths per day - Australia"];plotBRdeaths=DateListPlot[{BRdeaths},PlotRangeAll,PlotLabel"Covid-19 Deaths per day - Brazil"];
Plot tests per day
In[]:=
plotUStests=DateListPlot[{UStests},PlotRangeAll,PlotLabel"Covid-19 Tests per day - USA "];plotAUtests=DateListPlot[{AUtests},PlotRangeAll,PlotLabel"Covid-19 Tests per day - Australia"];plotBRtests=DateListPlot[{BRtests},PlotRangeAll,PlotLabel"Covid-19 Tests per day - Brazil"];
Display the plots
In[]:=
GraphicsRow[{plotAUcases,plotAUdeaths,plotAUtests}]GraphicsRow[{plotUScases,plotUSdeaths,plotUStests}]GraphicsRow[{plotBRcases,plotBRdeaths,plotBRtests}]
Out[]=
Out[]=
Out[]=
Lag hypothesisIn online discussion several people claimed the unusual relationship between new cases and new deaths in the USA could be explained by a lag between infection and death.The following section computes normalised samples of deaths and new cases so they can be plotted on the same chart.
In[]:=
d=GaussianFilter[USdeaths[All,"new_deaths"],10]//Normal;m=Mean[d];max=Max[d];min=Min[d];(*a=ListLinePlot[(d-m)/(max-min),PlotRange->All,PlotStyle{Black}];*)a=ListLinePlot[d,PlotRange->All,PlotStyle{Black}];d=GaussianFilter[UScases[All,"new_cases"]*1.7/100,10]//Normal;m=Mean[d];max=Max[d];min=Min[d];(*b=ListLinePlot[(d-m)/(max-min),PlotRange->All,PlotStyle{Red}];*)b=ListLinePlot[d,PlotRange->All,PlotStyle{Red}];
In[]:=
Show[a,b,AxesLabel{HoldForm[Days],RawBoxes[RowBox[{RowBox[{"Normalised"," ","infections"}],","," ","deaths"}]]},PlotLabelHoldForm[USA],LabelStyle{GrayLevel[0]}]
Out[]=
The chart shows cases leading deaths, but after 160 days the lines diverge. The noticeable departure between infections per day and deaths per day cannot be explained by a lag between infection and death.
Until late July 2020 infections per day data was published by the CDC and deaths per day by the US government. In late July 2020 the US government required new infections per day be reported directly to the US government rather than the CDC. It will be interesting to see if infections per day change to match deaths per day after this.
Until late July 2020 infections per day data was published by the CDC and deaths per day by the US government. In late July 2020 the US government required new infections per day be reported directly to the US government rather than the CDC. It will be interesting to see if infections per day change to match deaths per day after this.