Description Usage Arguments Details Author(s) Examples
This function computes the probability of secondary infections per infected cases, based on their dates of onset and isolation, and on the average reproduction number (i.e. number of secondary cases per index case). Only cases isolated within a defined time window are retained for the analysis. NOTE: this function is experimental and developed for the response to Ebola in North Kivu. Do not use it without consulting the authors first.
1 2 |
onset |
a vector of dates of onset |
isolation |
a vector of dates of isolation / outcome (when patients are assumed to ' no longer seed infections) |
R |
the average reproduction number, i.e. number of secondary cases per infected case; can be a single value, or a vector with one value per case (recycled if needed) |
time_period |
the number of days since the isolation for cases to be included in the analysis |
p_delay |
function giving the cumulative mass function of the delay
from symptom onset to secondary infections (in usual distributions,
starting with |
reference_day |
the day to use as current date, as a |
If d(.) is the probability mass function of the delay from onset of the index case to secondary infection, and $R$ the average reproduction number, the average risk of secondary infections is computed as:
risk(t) = R * ∑_{t = onset}^{isolation - 1} w(t)
Thibaut Jombart (thibautjombart@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | isolation <- today() - rpois(50, 10)
onset <- isolation - rpois(50, 7)
delay <- function(t) pgeom(t, prob = .2)
risks <- case_risk(onset, isolation, R = 1.2,
time_period = 14, p_delay = delay)
risks
df <- data.frame(id = factor(1:50), onset, isolation, risks)
if (require(ggplot2)) {
ggplot(df, aes(y = id, yend = id)) +
geom_segment(aes(x = onset, xend = isolation, color = risks),
size = 4) +
geom_vline(aes(xintercept = today())) +
scale_color_gradientn("Risk 2nd cases", colors = c("#80aaff", "gold", "#b3003b")) +
labs(title = "Risk and infectious period",
x = "Infectious period (onset -> isolation)")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.