Description Usage Arguments Details Value Author(s) Examples
This function compute the tracing score of a contact, i.e. an individual who has had at least one recorded exposure to a case. For a contact, the tracing score is defined as the probability that this individual will show symptoms for the first time on day 't'.
1 | contact_score(x, R, lambda, w)
|
x |
A vector of integers indicating dates of onset of the cases causing exposure. |
R |
The average effective reproduction number, i.e. the average number of secondar cases seeded by an infected individual. |
lambda |
The average number of contacts (infectious or not) reported by cases. |
w |
The probability mass function of the serial interval, i.e. the delay
from primary to secondary symptom onset. We recommend using the
|
See the distcrete
package for generating discretized
distributions at: http://github.com/reconhub/distcrete.
A function with two arguments:
t
: the date for which the score should be computed.
visit_days_ago
: the number of days since the last visit to the
contact, defaulting to 1
, which means that the last visit happened the
day before t
.
Thibaut Jombart (thibautjombart@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | if (require(distcrete)) {
## generate serial interval distribution
SI <- distcrete("gamma", 1L, w = 0, 10, 0.65)$d
plot(SI, type="h", xlim=c(0,50), xlab = "Days")
title("Serial interval distribution")
## get tracing score function for:
## - exposure to cases with onsets: 1, 10, 25
## - R = 2.1
## - lambda = 3.5
f <- contact_score(c(1,10,25), R = 2.1, lambda = 3.5, SI)
## score for various days
f(0) # day 0
f(10) # day 10
f(10:20)
## plot score for various days
plot(f, type = "h", xlim = c(0,60), col = pal1(100),
xlab = "Date", ylab = "P(new symptoms)")
title("Contact score over time")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.