-
-
Save locklin/94b7f758ece1ea347fcd000e308545cd to your computer and use it in GitHub Desktop.
dumb 'rona calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## install.packages("MMWRweek") | |
require("MMWRweek") | |
require(xts) | |
require(timeDate) | |
## May 1 2022 | |
read.csv("https://www.cdc.gov/flu/weekly/weeklyarchives2021-2022/data/NCHSData16.csv") -> data2022 | |
pnts <- xts(data2022$All.Deaths ,as.timeDate(MMWRweek2Date(data2022$Year,data2022$Week)) + 7 * 24 * 3600) | |
mean(apply.yearly(pnts["::2019"],sum)) ## mean deaths of recent pre-rona years | |
years <- apply.yearly(pnts,sum) ## deaths each year | |
years.adj <- years | |
years.adj[10] = last(years.adj)*52/16 ## naively adjusted 2022 | |
plot(pnts) ## you can see the peaks | |
as.numeric(years[8]) - last(apply.yearly(pnts["::2019"],sum)) | |
as.numeric(years[9]) - last(apply.yearly(pnts["::2019"],sum)) | |
as.numeric(years.adj[10]) - last(apply.yearly(pnts["::2019"],sum)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment