A modular Bayesian framework for real-time infectious disease surveillance. Provides tools for nowcasting, reproduction number estimation, delay estimation, and forecasting from data subject to reporting delays, right-truncation, missing data, and incomplete ascertainment. Users can build models suited to their setting using a flexible formula interface supporting fixed effects, random effects, random walks, and time-varying parameters, with options including parametric and non-parametric delay distributions with optional modifiers (via discrete-time hazard models), renewal processes, observation models, missing data imputation, and stratified analyses with partial pooling. By jointly estimating disease dynamics and reporting patterns, our framework enables earlier and more reliable detection of trends. While designed with epidemiological applications in mind, the framework can be applied to any right-truncated time series count data.
The default lognormal reporting delay distribution may not suit all data. It can fail with multimodal or complex delay patterns. Evaluate model fit and consider alternatives (e.g., non-parametric hazards) as needed. See the package vignettes for guidance.
Installing the package
You can install the latest released version using the normal R
function, though you need to point to r-universe instead of CRAN:
install.packages(
"epinowcast", repos = "https://epinowcast.r-universe.dev"
)Alternatively, you can use the remotes
package to install the development version
from Github (warning! this version may contain breaking changes and/or
bugs):
remotes::install_github(
"epinowcast/epinowcast",
dependencies = TRUE
)Similarly, you can install historical versions by specifying the release
tag (e.g. this installs
0.2.0):
remotes::install_github(
"epinowcast/epinowcast",
dependencies = TRUE, ref = "v0.2.0"
)Note: You can also use that last approach to install a specific commit if needed, e.g. if you want to try out a specific unreleased feature, but not the absolute latest developmental version.
Installing CmdStan
If you wish to do model fitting and nowcasting, you will need to install
CmdStan, which also
entails having a suitable C++ toolchain setup. We recommend using the
cmdstanr package. The Stan team
provides instructions in the Getting started with
cmdstanr
vignette, with other details and support at the package
site along with some key instructions
available in the Stan resources package
vignette,
but the brief version is:
# if you not yet installed `epinowcast`, or you installed it without `Suggests` dependencies
install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
# once `cmdstanr` is installed:
cmdstanr::install_cmdstan()Note: You can speed up CmdStan installation using the cores argument.
If you are installing a particular version of epinowcast, you may also
need to install a past version of CmdStan, which you can do with the
version argument.
Alternative: Docker
We also provide a Docker image
with epinowcast and all dependencies
installed.
You can use this image to run epinowcast without installing
dependencies.
As you use the package, the documentation available via ?enw_ should
be your first stop for troubleshooting. We also provide a range of other
documentation, case studies, and community spaces to ask (and answer!)
questions:
Package Website
The epinowcast website includes a
function reference, model outline, and case studies using the package.
The site mainly concerns the release version, but you can also find
documentation for the latest development
version.
R Vignettes
We have created package vignettes to help you get started nowcasting, see a quick reference to package capabilities (different timesteps, multi-stratification, mixed models, etc.), and explore case studies.
Organisation Website
Our organisation website includes links to other resources, guest posts, and seminar schedule for both upcoming and past recordings.
Community Forum
Our community forum has areas for
question and answer
and considering new methods and
tools, among others. If
you are generally interested in real-time analysis of infectious
disease, you may find this useful even if do not use epinowcast.
Package Analysis Scripts
In addition to the vignettes, the package also comes with example
analyses.
These are not as polished as the vignettes, but we typically explore new
features with these and they may help you if you are using a development
version. After installing epinowcast, you can find them via:
list.files(
system.file("examples", package = "epinowcast"), full.names = TRUE
)We welcome contributions and new contributors! We particularly appreciate help on identifying and identified issues. Please check and add to the issues, and/or add a pull request and see our contributing guide for more information.
If you need a different underlying model for your work: epinowcast
lets you pass your own models! If you do try new model parameterisations
that expand the overall flexibility or improve the defaults, please let
us know either here or on the community
forum. We always like to hear about
new use-cases, whether or not they are directed at the core epinowcast
applications.
Please briefly describe your problem and what output you expect in an issue. If you have a question, please don’t open an issue. Instead, ask on our Q and A page. See our contributing guide for more information.
Please note that the epinowcast project is released with a
Contributor Code of
Conduct.
By contributing to this project, you agree to abide by its terms.
If making use of our methodology or the methodology on which ours is
based, please cite the relevant papers from our model
outline. If you use
epinowcast in your work, please consider citing it with
citation("epinowcast").
All contributions to this project are gratefully acknowledged using the
allcontributors package
following the all-contributors
specification. Contributions of any kind are welcome!
seabbs, adrian-lison, sbfnk, Bisaloo, pearsonca, choi-hannah, medewitt, jamesmbaazam, pitmonticone, athowes, jessalynnsebastian, kathsherratt, barbora-sobolova, kaitejohnson, Lnrivas, natemcintosh, nikosbosse, pratikunterwegs
teojcryan, FelixGuenther, beansrowning, jbracher, zsusswein, christinesangphet, rumackaaron, micahwiesner67, kylieainslie, maria-tang
jhellewell14, Gulfa, parksw3, TimTaylor, WardBrian, jimrothstein
