simpsons_paradox_covid | R Documentation |
A dataset on Delta Variant Covid-19 cases in the UK. This dataset gives a great example of Simpson's Paradox. When aggregating results without regard to age group, the death rate for vaccinated individuals is higher – but they have a much higher risk population. Once we look at populations with more comparable risks (breakout age groups), we see that the vaccinated group tends to be lower risk in each risk-bucketed group and that many of the higher risk patients had gotten vaccinated. The dataset was brought to OpenIntro's attention by Matthew T. Brenneman of Embry-Riddle Aeronautical University. Note: some totals in the original source differ as there were some cases that did not have ages associated with them.
simpsons_paradox_covid
A data frame with 286,166 rows and 3 variables:
Age of the person. Levels: under 50
, 50 +
.
Vaccination status of the person. Note: the vaccinated group includes those who were only partially vaccinated. Levels: vaccinated
, unvaccinated
Did the person die from the Delta variant? Levels: death
and survived
.
Public Health England: Technical briefing 20
library(dplyr)
library(scales)
# Calculate the mortality rate for all cases by vaccination status
simpsons_paradox_covid |>
group_by(vaccine_status, outcome) |>
summarize(count = n()) |>
ungroup() |>
group_by(vaccine_status) |>
mutate(total = sum(count)) |>
filter(outcome == "death") |>
select(c(vaccine_status, count, total)) |>
mutate(mortality_rate = label_percent(accuracy = 0.01)(round(count / total, 4))) |>
select(-c(count, total))
# Calculate mortality rate by age group and vaccination status
simpsons_paradox_covid |>
group_by(age_group, vaccine_status, outcome) |>
summarize(count = n()) |>
ungroup() |>
group_by(age_group, vaccine_status) |>
mutate(total = sum(count)) |>
filter(outcome == "death") |>
select(c(age_group, vaccine_status, count, total)) |>
mutate(mortality_rate = label_percent(accuracy = 0.01)(round(count / total, 4))) |>
select(-c(count, total))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.