joachim-gassen / tidycovid19

{tidycovid19}: An R Package to Download, Tidy and Visualize Covid-19 Related Data
https://joachim-gassen.github.io/tidycovid19/
Other
146 stars 44 forks source link

Is the definition of active cases correct? #22

Closed AndreaPi closed 4 years ago

AndreaPi commented 4 years ago

According to plot_covid19_spread help, the value active for the argument type is defined as:

"active", defined as the difference of "confirmed" and "recovered".

As a matter of fact, the corresponding code does exactly that:

https://github.com/joachim-gassen/tidycovid19/blob/0b0bf2724c5ce6652f21384e68c1c5648b522386/R/plot_covid19_spread.R#L116

Is this correct? Shouldn't it be confirmed -deaths - recovered, instead than just confirmed-recovered? I.e.

dplyr::mutate(active = .data$confirmed - .data$recovered - .data$deaths) 

BTW, I made a PR to correct a small typo in the help, you may want to check it out 😉

AndreaPi commented 4 years ago

To reinforce the message: using confirmed-recovered as the definition of active leads to some really awkward visualizations... now we look like the best large country in Europe, which is flattering (a number of active cases on par with Finland! Yay Italy!) but hardly realistic, I would say...

image

joachim-gassen commented 4 years ago

Apologies for the delay. You are right. My definition of 'active cases' predates the definition that the JHU CSSE teams uses and was not making any assumption about whether Covid-19 related deaths are always included in confirmed cases.

While I am still not certain whether this is case (many undiagnosed Covid 19 cases are only diagnosed post mortem), in the meantime the JHU CSSE team has itself included a recovered measure that follows your definition. So, I will update the package code later today.

Thanks for bringing that up and also for the typo fix in the PR!

AndreaPi commented 4 years ago

You're welcome! BTW, did you see Rob Hyndman's blog about the mortality data, and how to get similar plots to the FT ones on excess mortality?

https://robjhyndman.com/hyndsight/excess-deaths/

If this is a feature you may be interested in, I could submit a PR. No guarantees that it will fit perfectly in the current package structure 😀 it might need a bit of rework on your part.