Title: | Estimate the Unit-Wide Probability of COVID-19 |
Version: | 0.1.0 |
Description: | We propose a method to estimate the probability of an undetected case of COVID-19 in a defined setting, when a given number of people have been exposed, with a given pretest probability of having COVID-19 as a result of that exposure. Since we are interested in undetected COVID-19, we assume no person has developed symptoms (which would warrant further investigation) and that everyone was tested on a given day, and all tested negative. |
URL: | https://github.com/eebrown/covidprobability |
BugReports: | https://github.com/eebrown/covidprobability/issues |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Imports: | stats, utils |
Depends: | R (≥ 2.10) |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2021-02-07 16:31:02 UTC; ericbrown |
Author: | Eric Brown |
Maintainer: | Eric Brown <eb@ericebrown.com> |
Repository: | CRAN |
Date/Publication: | 2021-02-11 10:00:14 UTC |
Calculate pretest probability change over time
Description
Calculates the pretest probability over time, assuming the individual does not develop symptoms, by taking into account the distribution of incubation periods (defined as the time from exposure to symptom onset).
Usage
adjust_pretest(pre0, asympt, days = 14, mu = 1.63, sigma = 0.5)
Arguments
pre0 |
Initial pretest probability (on day of exposure) |
asympt |
The proportion of positive patients who would be expected not to ever develop symptoms (true asymptomatic patients). |
days |
Days since exposure for calculation range |
mu |
The mean of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 1.63 (see reference). |
sigma |
The standard deviation of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 0.5 (see reference). |
Value
pretest probability by day (time series)
References
See McAloon et al. https://bmjopen.bmj.com/content/10/8/e039652/
Calculate posttest probability from pretest probability and test characteristics
Description
Calculate posttest probability from pretest probability and test characteristics
Usage
calc_postest_prob(pretest_prob, sens, spec)
Arguments
pretest_prob |
Pretest probability |
sens |
Test sensitivity |
spec |
Test specificity |
Value
posttest probability
Calculate a time series of probability for an individual following exposure
Description
The probability that an individual has COVID-19 will change over time as new information is gleaned. The initial probability is the pretest probability (pre0) associated with the nature of the interaction/exposure. This probability will decrease with each passing day that the individual does not develop symptoms. When a test is done, the probability is the posttest probability; this reduces the probability based on the test characteristics at the time of testing. Subsequently, the probability will continue to decrease with each passing day that no symptoms develop. This function returns a time series including those 3 phases.
Usage
individual_probability(test_day, pre0, sens, spec, asympt, days, mu, sigma)
Arguments
test_day |
Day of PCR test (days since exposure) |
pre0 |
Pre-test probability of person on day of exposure |
sens |
A vector of sensitivities by day since exposure |
spec |
The specificity of the PCR test |
asympt |
The proportion of infected patients expected to remain asymptomatic throughout the course of infection |
days |
Days since exposure for calculation range |
mu |
The mean of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 1.63 (see reference). |
sigma |
The standard deviation of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 0.5 (see reference). |
Value
A time series of probabilities
Calculate post-test probability if testing occurred on each day in a series
Description
Given an initial pretest probability, and assuming symptoms never arise, with each passing day the pretest probability will be lower, given the person did not experience symptoms. This returns a vector of posttest probabilities which takes all of the above into account, assuming a negative test on each day. Note this is not a time series, and does not reflect if serial testing were done each day and assumes testing was only done once.
Usage
posttest_series(pre0, asympt, days = 14, mu = 1.63, sigma = 0.5, sens, spec)
Arguments
pre0 |
The pretest probability on day 0 (at exposure) |
asympt |
The proportion of infected patients expected to remain asymptomatic throughout the course of infection |
days |
Days since exposure for calculation range |
mu |
The mean of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 1.63 (see reference). |
sigma |
The standard deviation of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 0.5 (see reference). |
sens |
A vector of sensitivities by day since exposure |
spec |
The test specificity |
Value
A vector of posttest probabilities
Find the probability of any (at least one) event happening
Description
For an event that occurs with probability p, this function returns the probability of an occurrence given n repetitions. p is numeric and can be a vector.
Usage
probability_any(n, p)
Arguments
n |
The number of times to repeat the event (independent) |
p |
The individual probability of the event happening |
Details
The probability that any event p occurs with n repetitions is equal to the
reciprocal of the probability that p never occurs. The probability that p
never occurs with n repetitions is (1 - p) ^ n
. Thus, the probability
that any event p occurs after n repetitions is 1 - ( (1 - p) ^ n )
.
Value
The probability of an event with the specified probability, after n repetitions
Examples
probability_any(1, 0.5)
probability_any(2, 0.5)
probability_any(2, c(0.5, 1/3, 0.25))
The remaining individuals who would not be expected to show symptoms yet
Description
Every day, a certain number of people are expected to show symptoms, based on the incubation period. This would typically lead to further investigation and ongoing suspicion of an outbreak. This function calculates the proportion of individuals on a given day that would not be expected to have developed symptoms yet. So if no one has developed symptoms, this proportion of people could still have undetected COVID-19.
Usage
prop_remaining(t, asympt, mu = 1.63, sigma = 0.5)
Arguments
t |
day |
asympt |
The proportion of positive patients who would be expected not to ever develop symptoms (true asymptomatic patients). |
mu |
The mean of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 1.63 (see reference). |
sigma |
The standard deviation of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 0.5 (see reference). |
Value
Proportion who would not be expected to show symptoms yet
References
See McAloon et al. https://bmjopen.bmj.com/content/10/8/e039652/
COVID-19 PCR sensitivity by days since exposure
Description
COVID-19 PCR sensitivity by days since exposure
Usage
sens
Format
A data frame with 21 rows and 3 variables:
- point
point estimate of sensitivity
- lower
lower 95% confidence interval of sensitivity
- upper
upper 95% confidence interval of sensitivity
Source
https://github.com/HopkinsIDD/covidRTPCR
Calculate a time series of unit-wide probability following exposure
Description
To calculate the probability that any asymptomatic person has COVID-19,
this function treats each person/exposure as independent events and
calculates the probability time series using the individuals time series from
individual_probability()
.
Usage
unit_probability(test_day, pre0, sens, spec, asympt, days, mu, sigma, n)
Arguments
test_day |
Day of PCR test (days since exposure) |
pre0 |
Pre-test probability of person on day of exposure |
sens |
A vector of sensitivities by day since exposure |
spec |
The specificity of the PCR test |
asympt |
The proportion of infected patients expected to remain asymptomatic throughout the course of infection |
days |
Days since exposure for calculation range |
mu |
The mean of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 1.63 (see reference). |
sigma |
The standard deviation of a lognormal distribution that approximates the incubation period for COVID-19. E.g. 0.5 (see reference). |
n |
Number of exposed individuals |
Value
The probability of an event with the specified probability, after n repetitions