Closed OJWatson closed 2 years ago
In src/compile_plots_si/script.R just need to make the death curves that have been fitted to. I have quickly done it for the SI, but copy something like the following into this task:
src/compile_plots_si/script.R
data = tibble( deaths = c( 118, 378, 813, 935, 656, 331, 173, 88, 46, 24, 19, 33, 44, 40, 38, 62, 114, 191, 263, 305, 348, 473, 659, 737, 606, 368, 183, 82, 36, 23, 24, 21, 18, 43, 87, 148, 225, 298, 388, 467, 387, 309, 259, 218, 164 ) ) %>% mutate( week_start = as_date("2021-12-01") - 7 * rev(seq_along(deaths)), week_end = week_start + 7 ) population = c( 19676332, 20045152, 21089487, 21242908, 22258745, 23835330, 23052479, 21615791, 20294599, 20053798, 20577807, 21542270, 20669143, 17819027, 14354863, 9727734, 13147182 ) data2 = tibble( deaths = c(14506, 50601, 62041, 83553, 110407, 137149, 133691, 98801, 82238, 81455, 64927, 63541, 65007, 63094, 55199, 34818, 36804, 49677, 51421, 64591, 163419, 271734, 600103, 624699, 407582, 140985, 126373, 129763, 136651, 118683, 101090, 92772, 94338, 94087, 90210, 81653, 76853, 43591) ) %>% mutate( week_start = as_date("2021-12-01") - 7 * rev(seq_along(deaths)), week_end = week_start + 7 ) population2 = c( 116879507, 117982127, 126155952, 126045566, 122504804, 117397269, 112176098, 103460178, 90219894, 79440280, 68875962, 59256268, 48890528, 38260283, 24091443, 15083955, 13284271 ) gg1 <- ggplot(data, aes(week_start, deaths/sum(population)*(sum(population)/1e5))) + geomtextpath::geom_textvline(label = "Delta Introduction", xintercept = as.Date("2021-07-01"), hjust = 0.2, linetype = 2) + geom_step(color = "red") + theme_bw() + ylab("Weekly Deaths per 100,000\n") + xlab("") + ggpubr::theme_pubr() gg2 <- ggplot(data2, aes(week_start, deaths/sum(population2)*(sum(population2)/1e5))) + geom_step(color = "purple") + geomtextpath::geom_textvline(label = "Delta Introduction", xintercept = as.Date("2021-07-01"), hjust = 0.2, linetype = 2) + theme_bw() + ylab("Weekly Deaths per 100,000\n") + xlab("") + ggpubr::theme_pubr() gg <- cowplot::plot_grid(gg1, gg2, labels = c("c", "d")) cowplot::save_plot("test.png", gg, base_height = 4, base_width = 10)
Added
In
src/compile_plots_si/script.R
just need to make the death curves that have been fitted to. I have quickly done it for the SI, but copy something like the following into this task: