Fractional Subclinical Transmsisson
Calculate serial intervals and estimate fractional preclinical transmsission
Clinical Onset
The find_clinical_onset() function identifies first occurrence of score > 0 then creates new “Event” column with 1 at this date, 0’s before this date, and a value 3 after that date.
Hide code
<- as.data.frame(
clin_start_df find_clinical_onset(antem_df)
)
<- clin_start_df %>%
onsets_df filter(Event == 1)
Empiracal Incubation Period
Hide code
<- clin_start_df %>%
empirical_incub_periods group_by(animal, group) %>%
summarise(
incubation_period = if (nrow(filter(pick(everything()), Event == 1)) == 0) {
NA
else {
} as.numeric(
filter(pick(everything()), Event == 1)$date - filter(pick(everything()), dpe == 0)$date
)
}%>%
) ungroup()
<- as.data.frame(
group_incu %>%
empirical_incub_periods group_by(group) %>%
summarise(mean_incu = mean(incubation_period, na.rm=T),
sd_incu = sd(incubation_period, na.rm=T)) %>%
filter(group %in% c("Group 2", "Group 3", "Group 4"))
)
<- empirical_incub_periods %>%
emp_incub filter(is.na(incubation_period) == FALSE)
Empirical Serial Interval
Hide code
<- onsets_df[onsets_df$group == "donor", ]
donors <- onsets_df[onsets_df$group != "donor", ]
secondary
<- list()
serial_intervals # loop over each donor
for (i in 1:nrow(donors)) {
<- donors$date[i]
donor_date <- donors$animal[i]
donor_animal
# serial intervals
<- secondary$date - donor_date
intervals
<- data.frame(
serial_intervals[[donor_animal]] donor = donor_animal,
secondary = secondary$animal,
group = secondary$group,
serial_interval = as.numeric(intervals)
)
}
<- do.call(rbind, serial_intervals)
serial_intervals_df
range(serial_intervals_df$serial_interval)
[1] 1 3
Hide code
<- as.data.frame(
group_si %>%
serial_intervals_df group_by(group) %>%
summarize(si_mean = mean(serial_interval),
si_sd = sd(serial_interval)) %>%
filter(group %in% c("Group 2", "Group 3", "Group 4"))
)
<- left_join(group_incu, group_si, by = "group") group_means
Bootstrap Preclinical Fraction
Hide code
<- bootstrap_preclinical_frac(group_means)
boot_out
$plot boot_out