# How to calculate 95% CI of vaccine with 90% efficacy?

A vaccine is reported in the news to have 90% efficacy. I'd like to know how much confidence there is in that efficacy measure.

The protocol for this reports that a vaccine or placebo was administered to 43538 patients. Half received the vaccine, half received a placebo.

Of those who received the vaccine, 94 people were infected. With a 90% efficacy being reported, that implies that of the infected, 86 people received placebo and 8 were given the vaccine.

I can create a 2x2 contingency table and run a risk ratio calculator on that table:

> ct <- cbind(c(21683,21761), c(86,8))
> rownames(ct) <- c("Placebo", "Vaccine")
> colnames(ct) <- c("Not Infected", "Infected")
> library("epitools")
> riskratio(ct)
$data Not Infected Infected Total Placebo 21683 86 21769 Vaccine 21761 8 21769 Total 43444 94 43538$measure
NA
risk ratio with 95% C.I.   estimate      lower     upper
Placebo 1.00000000         NA        NA
Vaccine 0.09302326 0.04508851 0.1919186

$p.value NA two-sided midp.exact fisher.exact chi.square Placebo NA NA NA Vaccine 0 1.153398e-17 8.027243e-16$correction
[1] FALSE

attr(,"method")
[1] "Unconditional MLE & normal approximation (Wald) CI"


Did I set up the table and analysis correctly, and how does the calculated risk ratio value (and its CI) affect the efficacy? That is, how much range is there around the given efficacy?

• By a complete coincidence, just this morning: r-bloggers.com/2020/11/… Commented Nov 10, 2020 at 16:55
• @prisoner006 The CDC website explains how to calculate vaccine efficacy, which is defined as 1 minus RR. So, with an estimated RR (risk ratio) of 0.093 (your set-up is correct) for the vaccinated compared with unvaccinated, the estimated efficacy is 0.907 (expressed as 90% efficacy--perhaps should be 91% assuming your numbers are correct--but 90% is a good talking point). cdc.gov/csels/dsepd/ss1978/lesson3/section6.html Commented Nov 10, 2020 at 18:19
• Indeed, the fragmentary information in the Pfizer press release seems very encouraging. But serious assessments about the usefulness of this vaccine must await a peer reviewed article. In particular, there is no clue yet about how long immunity lasts. Commented Nov 10, 2020 at 19:48
• Is there an advantage of reporting efficacy over risk ratios? The latter appear, when given with confidence intervals, more straight-forward, and additionally somewhat avoids temptation of recasting as percentages which sometimes slightly complicate things by trying to figure out percentage of what. Commented Oct 20, 2021 at 11:01

One way to do it is to fit a Poisson model (a very close approximation to the binomial with such low rates), and compare the estimated risks:

library("emmeans")

dat <- data.frame(
group = c("placebo", "vaccine"),
infected = c(86, 8),
N = c(86, 8) + c(21683, 21761))

mod <- glm(infected ~ group + offset(log(N)), data = dat, family = "poisson")


Using emmeans::emmeans, we can obtain estimates of the rates per 1000:

risk <- emmeans(mod, "group", at = list(N = 1000), type = "response")
risk
##  group    rate    SE  df asymp.LCL asymp.UCL
##  placebo 3.951 0.426 Inf     3.198     4.880
##  vaccine 0.367 0.130 Inf     0.184     0.735
##
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale


These estimates match those we compute manually:

with(dat, 1000*infected / N)
## [1] 3.9505719 0.3674951


Now, just do the paired comparison. With type = "response", this is converted to a ratio -- the infection risk ratio:

irr <- pairs(risk, reverse = TRUE)
confint(irr)
##  contrast          ratio     SE  df asymp.LCL asymp.UCL
##  vaccine / placebo 0.093 0.0344 Inf    0.0451     0.192
##
## Confidence level used: 0.95
## Intervals are back-transformed from the log scale
`

The efficacy is thus 1 - 0.093 = 90.7%, with a 95% CI of 80.8% to 95.49%.

Created on 2020-11-30 by the reprex package (v0.3.0)

Use the online calculator. The relative risk (RR), its standard error and 95% confidence interval are calculated according to Altman, 1991.