library(tidyverse)

totalp <- 18325
totalv <- 18198
total <- totalp + totalv
total
infp <- 162
infv <- 8
inftot <- infp + infv
inftot
notinfp <- totalp - infp
notinfp
notinfv <- totalv - infv
notinfv

riskv <- (infv/totalv) * 100
riskv
riskp <- (infp/totalp) * 100
riskp

# Relative Risk (%)
rel_risk <- (riskv/riskp) * 100
rel_risk

# Attributable Risk (%)
att_risk <- (riskp-riskv)
att_risk

# Number Needed to Treat
nnt <- 1/(att_risk/100)
round(nnt)

# March 2021
total_vac <- 220000
saved_inf <- (att_risk/100) * total_vac
round(saved_inf)
mortality_rate <- 0.02
saved_lives <- mortality_rate * round(saved_inf)
round(saved_lives)

# January 30, 2022
# https://data.news-leader.com/covid-19-vaccine-tracker/west-virginia/54/
ctotal_vac <- 1006201
csaved_inf <- (att_risk/100) * ctotal_vac
round(csaved_inf)
mortality_rate <- 0.02
csaved_lives <- mortality_rate * round(csaved_inf)
round(csaved_lives)


