- Notifications
You must be signed in to change notification settings - Fork3
Estimation of infectiousness in the early stage of an outbreak, with short-term predictions.
License
reconhub/earlyR
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package implements simple estimation of infectiousness, as measuredby the reproduction number (R), in the early stages of an outbreak. Thisestimation requires:
prior knowledge: theserial interval distribution, definedas themean andstandard deviation of the (Gamma) distribution.In general, these parameters are best taken from the literature.
data: the dailyincidence of the disease, includingonlyconfirmed and probable cases.
To install the current stable, CRAN version of the package, type:
install.packages("earlyR")To benefit from the latest features and bug fixes, install thedevelopment,github version of the package using:
devtools::install_github("reconhub/earlyR")
Note that this requires the packagedevtools installed.
The main features of the package include:
get_R: a function to estimateR as well as the force ofinfection over time, from incidence data; output is an object ofclassearlyRsample_R: a function to obtain a sample of likelyR valuesplot: a function to visualiseearlyRobjects (R or forceof infection).points: a function usingearlyRobjects to add the force ofinfection to an existing plot.
This example is a simplified version of theintroductoryvignette(see section below), whereearlyR is used in conjunction with otherpackages to assess infectiousness and growth potential of an early EbolaVirus Disease (EVD) outbreak. Here, we simply illustrate howearlyRcan be used for assessing infectiousness based on a fewconfirmed/probable cases.
In this example we assume a small outbreak of Ebola Virus Disease (EVD),for which the serial interval has been previously characterised. Westudy a fake outbreak, for which we will quantify infectiousness (R),and then project future incidence using the packageprojections.
The fake data we consider consist of confirmed cases with the followingsymptom onset dates:
onset<- as.Date(c("2017-02-04","2017-02-12","2017-02-15","2017-02-23","2017-03-01","2017-03-01","2017-03-02","2017-03-03","2017-03-03"))
We assume the current date is 21st March. We compute the daily incidenceusing the packageincidence:
library(incidence)today<- as.Date("2017-03-21")i<- incidence(onset,last_date=today)i#> <incidence object>#> [9 cases from days 2017-02-04 to 2017-03-21]#>#> $counts: matrix with 46 rows and 1 columns#> $n: 9 cases in total#> $dates: 46 dates marking the left-side of bins#> $interval: 1 day#> $timespan: 46 days#> $cumulative: FALSEplot(i,border="white")
Note: It isvery important to make sure that the last days withoutcases are included here. Omitting this information would lead to anover-estimation of the reproduction number (R).
For estimatingR, we need estimates of the mean and standard deviationof the serial interval, i.e. the delay between primary and secondarysymptom onset dates. This has been quantified durin the West African EVDoutbreak (WHO Ebola Response Team (2014) NEJM 371:1481–1495):
mu<-15.3# mean in days dayssigma<-9.3# standard deviation in days
The functionget_R is then used to estimate the most likely values ofR:
library(earlyR)library(ggplot2)res<- get_R(i,si_mean=mu,si_sd=sigma)res#>#> /// Early estimate of reproduction number (R) //#> // class: earlyR, list#>#> // Maximum-Likelihood estimate of R ($R_ml):#> [1] 1.041041#>#>#> // $lambda:#> NA 0.01838179 0.0273192 0.03514719 0.0414835 0.04623398...#>#> // $dates:#> [1] "2017-02-04" "2017-02-05" "2017-02-06" "2017-02-07" "2017-02-08"#> [6] "2017-02-09"#> ...#>#> // $si (serial interval):#> A discrete distribution#> name: gamma#> parameters:#> shape: 2.70655567117586#> scale: 5.65294117647059plot(res)
The first figure shows the distribution of likely values ofR, and theMaximum-Likelihood (ML) estimation. To derive other statistics for thisdistribution, we can usesample_R to get a large sample of likelyRvalues, and then compute statistics on this sample:
R_val<- sample_R(res,1000)summary(R_val)# basic stats#> Min. 1st Qu. Median Mean 3rd Qu. Max.#> 0.1902 0.9009 1.1211 1.1774 1.4314 2.7427quantile(R_val)# quartiles#> 0% 25% 50% 75% 100%#> 0.1901902 0.9009009 1.1211211 1.4314314 2.7427427quantile(R_val, c(0.025,0.975))# 95% credibility interval#> 2.5% 97.5%#> 0.5705706 2.0420420hist(R_val,border="grey",col="navy",xlab="Values of R",main="Sample of likely R values")
Finally, we can also represent infectiousness over time using:
plot(res,"lambdas",scale= length(onset)+1)+ geom_vline(xintercept=onset,col="grey",lwd=1.5)+ geom_vline(xintercept=today,col="blue",lty=2,lwd=1.5)#> Warning: Removed 1 rows containing missing values (position_stack).
This figure shows the global force of infection over time, with verticalgrey bars indicating the dates of symptom of onset. The dashed blue lineindicates current day. Note that the vertical scale for the bars isarbitrary, and only represents the relative force of infection.
`Currently available vignettes can be accessed fromR using:
vignette("earlyR"): anintroduction toearlyRusing a simulated Ebola Virus Disease (EVD) outbreak; includesprojections of future incidence usingprojections.
A dedicated website is still in development.
Bug reports and feature requests should be posted ongithub using theissue system. All otherquestions should be posted on theRECON forum:
http://www.repidemicsconsortium.org/forum/
Contributions are welcome viapull requests.
Please note that this project is released with aContributor Code ofConduct. By participating in this project you agree toabide by its terms.
About
Estimation of infectiousness in the early stage of an outbreak, with short-term predictions.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.



