pandemic_years <- c(1890, 1918, 1957, 2020, 2021)
table_s1 <-
bind_rows(
# baseline, ie. reported in paper `Age Serfling (Stan, NB)`
results_year %>%
mutate(Model = "m0") %>%
select(Model, Country, Year,
starts_with("yearly_excess_total_deaths")),
# Global Serfling (bootstrap)
# simply summed from monthly values to obtain year
# !without CI for yearly!
results_month_boot %>%
mutate(excess = Deaths - pred) %>%
group_by(Model, Country, Year) %>%
summarise(yearly_excess_total_deaths = sum(excess)) %>%
ungroup() %>%
mutate(Model = "m1"),
# Global Serfling (Stan, NB) without age
results_year_global %>%
mutate(Model = "m2") %>%
select(Model, Country, Year,
starts_with("yearly_excess_total_deaths")),
# Age Serfling with alternative time window & min/max trim (Stan, NB)
results_year_last_7_notrim %>%
mutate(Model = "m3") %>%
select(Model, Country, Year,
starts_with("yearly_excess_total_deaths")),
# Age Serfling with alternative time window (Stan, NB)
results_year_last_7_trim %>%
mutate(Model = "m4") %>%
select(Model, Country, Year,
starts_with("yearly_excess_total_deaths"))
) %>%
filter(Year %in% c(pandemic_years, pandemic_years - 1, pandemic_years + 1)) %>%
arrange(desc(Country), Year, Model) %>%
pivot_wider(names_from = Model,
values_from = starts_with("yearly_excess"),
names_sort = FALSE) %>%
relocate(Country, Year,
yearly_excess_total_deaths_m0,
yearly_excess_total_deaths_lower_m0,
yearly_excess_total_deaths_upper_m0,
yearly_excess_total_deaths_m1,
yearly_excess_total_deaths_lower_m1,
yearly_excess_total_deaths_upper_m1,
yearly_excess_total_deaths_m2,
yearly_excess_total_deaths_lower_m2,
yearly_excess_total_deaths_upper_m2,
yearly_excess_total_deaths_m3,
yearly_excess_total_deaths_lower_m3,
yearly_excess_total_deaths_upper_m3,
yearly_excess_total_deaths_m4,
yearly_excess_total_deaths_lower_m4,
yearly_excess_total_deaths_upper_m4
) %>%
select(-yearly_excess_total_deaths_lower_m1, -yearly_excess_total_deaths_upper_m1) %>%
mutate(
yearly_excess_total_deaths_m0 = number(yearly_excess_total_deaths_m0,
accuracy = 5L, big.mark = " "),
yearly_excess_total_deaths_m1 = number(yearly_excess_total_deaths_m1,
accuracy = 5L, big.mark = " "),
yearly_excess_total_deaths_m2 = number(yearly_excess_total_deaths_m2,
accuracy = 5L, big.mark = " "),
yearly_excess_total_deaths_m3 = number(yearly_excess_total_deaths_m3,
accuracy = 5L, big.mark = " "),
yearly_excess_total_deaths_m4 = number(yearly_excess_total_deaths_m4,
accuracy = 5L, big.mark = " ")
) %>%
mutate(
yearly_excess_total_deaths_m0_cri = str_c("(",
number(yearly_excess_total_deaths_lower_m0,
accuracy = 5L, big.mark = " "),
" to ",
number(yearly_excess_total_deaths_upper_m0,
accuracy = 5L, big.mark = " "),
")")
) %>%
relocate(yearly_excess_total_deaths_m0_cri,
.after = yearly_excess_total_deaths_m0) %>%
select(-yearly_excess_total_deaths_lower_m0,
-yearly_excess_total_deaths_upper_m0) %>%
mutate(
yearly_excess_total_deaths_m2_cri = str_c("(",
number(yearly_excess_total_deaths_lower_m2,
accuracy = 5L, big.mark = " "),
" to ",
number(yearly_excess_total_deaths_upper_m2,
accuracy = 5L, big.mark = " "),
")")
) %>%
relocate(yearly_excess_total_deaths_m2_cri,
.after = yearly_excess_total_deaths_m2) %>%
select(-yearly_excess_total_deaths_lower_m2,
-yearly_excess_total_deaths_upper_m2) %>%
mutate(
yearly_excess_total_deaths_m3_cri = str_c("(",
number(yearly_excess_total_deaths_lower_m3,
accuracy = 5L, big.mark = " "),
" to ",
number(yearly_excess_total_deaths_upper_m3,
accuracy = 5L, big.mark = " "),
")")
) %>%
relocate(yearly_excess_total_deaths_m3_cri, .after = yearly_excess_total_deaths_m3) %>%
select(-yearly_excess_total_deaths_lower_m3, -yearly_excess_total_deaths_upper_m3) %>%
mutate(
yearly_excess_total_deaths_m4_cri = str_c("(",
number(yearly_excess_total_deaths_lower_m4,
accuracy = 5L, big.mark = " "),
" to ",
number(yearly_excess_total_deaths_upper_m4,
accuracy = 5L, big.mark = " "),
")")
) %>%
relocate(yearly_excess_total_deaths_m4_cri, .after = yearly_excess_total_deaths_m4) %>%
select(-yearly_excess_total_deaths_lower_m4, -yearly_excess_total_deaths_upper_m4) %>%
mutate(across(yearly_excess_total_deaths_m0:yearly_excess_total_deaths_m4_cri,
~replace(., is.na(.), "--")))