Code: https://github.com/theosanderson/adhoc_covid/tree/main/pfizer_vaccine
library(tidyverse)
## -- Attaching packages --------------------------------------------------------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2 v purrr 0.3.4
## v tibble 3.0.3 v dplyr 1.0.2
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## -- Conflicts ------------------------------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
placebo <- read_csv("placebo_digitised_cumulative_incidence_vs_day.csv",col_names = c("Day","CumulativeIncidence"))
## Parsed with column specification:
## cols(
## Day = col_double(),
## CumulativeIncidence = col_double()
## )
vaccine <- read_csv("vaccine_digitised_cumulative_incidence_vs_day.csv",col_names = c("Day","CumulativeIncidence"))
## Parsed with column specification:
## cols(
## Day = col_double(),
## CumulativeIncidence = col_double()
## )
placebo$condition = "Placebo"
vaccine$condition = "Vaccine"
data<- bind_rows(placebo,vaccine)
data$Day=round(data$Day)
ggplot(data,aes(x=Day,y=CumulativeIncidence,color=condition))+geom_point()+geom_line()
day0 = filter(data, Day==0)
day10 = filter(data, Day==10)
day22 = filter(data, Day==22)
day22vsday0 = inner_join(day22,day0,by="condition") %>% mutate(diff=CumulativeIncidence.x-CumulativeIncidence.y) %>% summarise(
efficacy=( max(diff) - min(diff))/max(diff))
day22vsday0
day22vsday10 = inner_join(day22,day10,by="condition") %>% mutate(diff=CumulativeIncidence.x-CumulativeIncidence.y) %>% summarise(
efficacy=( max(diff) - min(diff))/max(diff))
day22vsday10
day10vsday0 = inner_join(day10,day0,by="condition")%>% mutate(diff=CumulativeIncidence.x-CumulativeIncidence.y) %>% summarise(
efficacy=( max(diff) - min(diff))/max(diff))
day10vsday0