{EpiNow2} estimates the time-varying reproductionnumber, growth rate, and doubling time using a range of open-sourcetools (Abbottet al.), and current best practices (Gostic et al.).It aims to help users avoid some of the limitations of naiveimplementations in a framework that is informed by community feedbackand is actively supported.
Forecasting is also supported for the time-varying reproductionnumber, infections, and reported cases using the same generative processapproach as used for estimation.
{EpiNow2} estimates the time-varying reproduction numberon cases by date of infection (using a similar approach to thatimplemented in{EpiEstim}).True infections, treated as latent and unobserved, are estimated andthen mapped to observed data (for example cases by date of report) viaone or more delay distributions (in the examples in the packagedocumentation these are an incubation period and a reporting delay) anda reporting model that can include weekly periodicity.
Uncertainty is propagated from all inputs into the final parameterestimates, helping to mitigate spurious findings. This is handledinternally. The time-varying reproduction estimates and the uncertaingeneration time also give time-varying estimates of the rate ofgrowth.
{EpiNow2} provides three models:
estimate_infections(): Reconstruct cases by date ofinfection from reported cases.
estimate_secondary(): Estimate the relationshipbetween primary and secondary observations, for example, deaths(secondary) based on hospital admissions (primary), or bed occupancy(secondary) based on hospital admissions (primary).
estimate_truncation(): Estimate a truncationdistribution from multiple snapshots of the same data source over time.For more flexibility, check out the{epinowcast}package.
The default model inestimate_infections() uses anon-stationary Gaussian process to estimate the time-varyingreproduction number and infer infections. Other options, which generallyreduce runtimes at the cost of the granularity of estimates or real-timeperformance, include:
By default, all these models are fit withMCMCsampling using therstanR package as the backend. Users can, however, switch to use approximatealgorithms likevariationalinference, thepathfinderalgorithm, orLaplaceapproximation especially for quick prototyping. The latter twomethods are provided through thecmdstanr Rpackage, so users will have to install that separately.
The documentation forestimate_infections providesexamples of the implementation of the different options available.
{EpiNow2} is designed to be used via a single functioncall to two functions:
epinow(): Estimate Rt and cases by date of infectionand forecast these infections into the future.
regional_epinow(): Efficiently runepinow() across multiple regions in an efficientmanner.
These two functions callestimate_infections(), whichworks to reconstruct cases by date of infection from reported cases.
For more details on using each function corresponding functiondocumentation.
Install the released version of the package:
install.packages("EpiNow2")Install the development version of the package with:
install.packages("EpiNow2",repos =c("https://epiforecasts.r-universe.dev",getOption("repos")))Alternatively, install the development version of the package withpak as follows (few users should needto do this):
# check whether {pak} is installedif (!require("pak")) {install.packages("pak")}pak::pkg_install("epiforecasts/EpiNow2")If usingpak fails, try:
# check whether {remotes} is installedif (!require("remotes")) {install.packages("remotes")}remotes::install_github("epiforecasts/EpiNow2")To build{EpiNow2} from source, users will need toconfigure their C toolchain. This is because{EpiNow2}implements the underlying models in Stan (a statistical modellingprogramming language), which is built on C++.
Each operating system has a different set up procedure. Windows usersneed to install an appropriate version ofRTools.Mac users canfollowthese steps, and Linux users can usethisguide.
The Getting Started vignette (seevignette("EpiNow2"))is your quickest entry point to the package. It provides a quick runthrough of the two main functions in the package and how to set up themup. It also discusses how to summarise and visualise the results afterrunning the models.
More broadly, users can also learn the details of estimating delaydistributions, nowcasting, and forecasting in a structured way throughthe free and open short-course,“Nowcasting and forecastinginfectious disease dynamics”, developed by some authors of thispackage.
The package has two websites: one forthe stable release version onCRAN, and another forthe version indevelopment. These two provide various resources for learning aboutthe package, including the function reference, details about each model(model definition), workflows for each model (usage), and case studiesor literature of applications of the package. However, the developmentwebsite may contain experimental features and information not yetavailable in the stable release.
The workflow vignette (seevignette("estimate_infections_workflow")) provides guidanceon the end-to-end process of estimating reproduction numbers andperforming short-term forecasts for a disease spreading in a
In different vignettes we provide the mathematical definition of eachmodel. For example, the model definition vignette forestimate_infections() can be found invignette("estimate_infections").
A simple example of using the package to estimate a national Rt forCovid-19 can be foundhere.
We welcome all contributions. If you have identified an issue withthe package, you can file an issuehere. We alsowelcome additions and extensions to the underlying model either in theform of options or improvements. If you wish to contribute in any form,please follow thepackagecontributing guide.
All contributions to this project are gratefully acknowledged usingtheallcontributorspackage following theallcontributors specification.Contributions of any kind are welcome!
seabbs,sbfnk,jamesmbaazam,joeHickson,hsbadr,pitmonticone,actions-user,ellisp,jdmunday,kaitejohnson,pearsonca,JAllen42,adamkucharski,andrjohns,Bisaloo,LloydChapman,medewitt,nikosbosse,sophiemeakin,zsusswein
raulfernandezn,pcarbo,johnaponte,sophie-schiller,munozedg,kathsherratt,yungwai,kgostic,fkrauer,philturk,krageth,tony352,username-rp,HAKGH,AndrewRiceMGW,brynhayder,RichardMN,andrybicio,rhamoonga,furqan915,MFZaini1984,fabsig,affans,GauriSaran,davidvilanova,jrcpulliam,dajmcdon,joshwlambert,avallecam,athowes,lorenzwalthert,nlinton,martinamcm,adrian-lison,micahwiesner67
jhellewell14,thlytras,LizaHadley,ntorresd,SamuelBrand1