Package: EpiNow2 1.9.0.9000

Sebastian Funk

EpiNow2: Estimate and Forecast Real-Time Infection Dynamics

Estimates the time-varying reproduction number, rate of spread, and doubling time using a renewal equation approach combined with Bayesian inference via Stan. Supports Gaussian process and random walk priors for modelling changes in transmission over time. Accounts for delays between infection and observation (incubation period, reporting delays), right-truncation in recent data, day-of-week effects, and observation overdispersion. Can estimate relationships between primary and secondary outcomes (e.g., cases to hospitalisations or deaths) and forecast both. Runs across multiple regions in parallel. Based on Abbott et al. (2020) <doi:10.12688/wellcomeopenres.16006.1> and Gostic et al. (2020) <doi:10.1101/2020.06.18.20134858>.

Authors:Sam Abbott [aut], Joel Hellewell [aut], Katharine Sherratt [aut], Katelyn Gostic [aut], Joe Hickson [aut], Hamada S. Badr [aut], Michael DeWitt [aut], James M. Azam [aut], Adrian Lison [aut], Robin Thompson [ctb], Sophie Meakin [ctb], James Munday [ctb], Nikos Bosse [ctb], Paul Mee [ctb], Peter Ellis [ctb], Pietro Monticone [ctb], Lloyd Chapman [ctb], Andrew Johnson [ctb], Kaitlyn Johnson [ctb], Adam Howes [ctb], Sebastian Funk [aut, cre]

EpiNow2_1.9.0.9000.tar.gz
EpiNow2_1.9.0.9000.zip(r-4.7)EpiNow2_1.9.0.9000.zip(r-4.6)EpiNow2_1.9.0.9000.zip(r-4.5)
EpiNow2_1.9.0.9000.tgz(r-4.6-x86_64)EpiNow2_1.9.0.9000.tgz(r-4.6-arm64)EpiNow2_1.9.0.9000.tgz(r-4.5-x86_64)EpiNow2_1.9.0.9000.tgz(r-4.5-arm64)
EpiNow2_1.9.0.9000.tar.gz(r-4.7-arm64)EpiNow2_1.9.0.9000.tar.gz(r-4.7-x86_64)EpiNow2_1.9.0.9000.tar.gz(r-4.6-arm64)EpiNow2_1.9.0.9000.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
EpiNow2/json (API)

# Install 'EpiNow2' in R:
install.packages('EpiNow2', repos = c('https://epiforecasts.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/epiforecasts/epinow2/issues

Pkgdown/docs site:https://epiforecasts.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

backcalculationcovid-19gaussian-processesopen-sourcereproduction-numberstancpp

12.34 score 140 stars 367 scripts 849 downloads 7 mentions 82 exports 63 dependencies

Last updated from:9e83745994. Checks:11 NOTE, 1 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64NOTE640
linux-devel-x86_64NOTE740
source / vignettesOK1032
linux-release-arm64NOTE633
linux-release-x86_64NOTE769
macos-release-arm64NOTE623
macos-release-x86_64NOTE877
macos-oldrel-arm64NOTE618
macos-oldrel-x86_64NOTE1039
windows-develNOTE893
windows-releaseNOTE871
windows-oldrelNOTE933
wasm-releaseFAIL256

Exports:add_breakpointsbackcalc_optsbootstrapped_dist_fitbound_distcalc_CrIcalc_CrIscalc_summary_measurescalc_summary_statsclean_nowcastscollapseconvert_to_logmeanconvert_to_logsdconvolve_and_scaledelay_optsDirichletdiscretisediscretizedist_fitepinowepinow2_cmdstan_modelestimate_delayestimate_distestimate_infectionsestimate_secondaryestimate_truncationExpexpose_stan_fnsextract_CrIsextract_initsextract_samplesextract_stan_paramfill_missingfilter_leading_zerosfix_parametersFixedforecast_infectionsforecast_optsforecast_secondaryGammageneration_time_optsget_distributionget_parametersget_pmfget_predictionsget_regional_resultsget_samplesgp_optsgrowth_to_Rgt_optsis_constrainedLogNormalmake_confmap_prob_changenew_dist_specNonParametricNormalobs_optsopts_listplot_estimatesplot_summaryR_to_growthregional_epinowregional_runtimesregional_summaryreport_plotsreport_summaryrt_optssecondary_optsset_dt_single_threadsetup_default_loggingsetup_futuresetup_loggingsimulate_infectionssimulate_secondarystan_laplace_optsstan_optsstan_pathfinder_optsstan_sampling_optsstan_vb_optstrunc_optsupdate_secondary_argsWeibull

Dependencies:abindbackportsBHcallrcheckmateclicpp11data.tabledescdistributionalfarverformatRfutile.loggerfutile.optionsgenericsggplot2gluegridExtragtableinlineisobandlabelinglambda.rlifecycleloolubridatemagrittrmatrixStatsnumDerivotelpatchworkpillarpkgbuildpkgconfigposteriorprimarycensoredprocessxpspurrrQuickJSRR.methodsS3R.ooR.utilsR6RColorBrewerRcppRcppEigenRcppParallelrlangrstanrstantoolsrunnerS7scalesStanHeaderstensorAtibbletimechangetruncnormutf8vctrsviridisLitewithr

Using epinow() for running in production mode
Running the model on a single region | Running the model simultaneously on multiple regions

Last update: 2026-07-01
Started: 2023-10-03

Getting started with EpiNow2
Quick start | Reporting delays, incubation period and generation time | epinow() | regional_epinow()

Last update: 2026-07-01
Started: 2024-01-09

Examples: estimate_infections()
Set up | Data | Parameters | Delays: incubation period and reporting delay | Generation time | Initial reproduction number | Running the model | Default options | Reducing the accuracy of the approximate Gaussian Process | Adjusting for future susceptible depletion | Adjusting for truncation of the most recent data | Projecting the reproduction number with the Gaussian Process | Fixed reproduction number | Breakpoints | Weekly random walk | No delays | Non-parametric infection model

Last update: 2026-06-17
Started: 2023-10-03

Forecasting multiple data streams
Background | Setup | Data | Estimating infections | Estimating secondary scaling and delay | Forecasting secondary outcomes

Last update: 2026-06-17
Started: 2025-02-27

Model definition: estimate_truncation()
Model | Priors

Last update: 2026-06-17
Started: 2022-10-17

Prior choice and specification guide
Introduction | Set up | Overview of all priors | estimate_infections() priors | estimate_secondary() priors | estimate_truncation() priors | Prior impacts and choice guidance | Reproduction number | Gaussian Process length scale | Gaussian Process magnitude | Random walk for $R_t$ (alternative to GP) | Observation model: overdispersion | Observation model: scaling | For estimate_infections(): | For estimate_secondary(): | Generation time distribution | Delays (incubation and reporting) | Truncation | Model choice in estimate_infections() | Priors for estimate_secondary() | Delay between primary and secondary | Priors for estimate_truncation() | Truncation distribution parameters | Practical workflow for prior specification | Step 1: Start with defaults | Step 2: Identify candidates for modification | Step 3: Modify one prior at a time | Step 4: Check prior predictive distributions | Step 5: Check model convergence | Common pitfalls and recommendations | Pitfall 1: Over-informative priors without justification | Pitfall 2: Ignoring generation time and delays | Pitfall 3: Estimating too many uncertain parameters | Pitfall 4: Wrong time scale for length scale | Pitfall 5: Forgetting the max parameter | References and further reading | Key papers

Last update: 2026-06-17
Started: 2025-11-13

Workflow for Rt estimation and forecasting
Data | Set up | Parameters | Delay distributions | Generation intervals | Reporting delays | Truncation | Completeness of reporting | Initial reproduction number | Weighing delay priors | Estimation and forecasting | Forecasting secondary outcomes | Interpretation | Evaluating forecasts with scoringutils

Last update: 2026-06-17
Started: 2023-10-03

Gaussian Process implementation details
Overview | Definition | Matérn 3/2 covariance kernel (the default) | Squared exponential kernel | Ornstein-Uhlenbeck (Matérn 1/2) kernel | Matérn 5/2 covariance kernel | Hilbert space approximation | Modelling the reproduction number | References

Last update: 2026-06-05
Started: 2023-04-27

Model definition: estimate_infections()
Infection model | Renewal equation model | Initialisation | Infections | Time-varying reproduction number | Beyond the end of the observation period | Adjusting for susceptible population depletion | Non-Mechanistic infection model | Delays and scaling | Observation model | Truncation | References

Last update: 2026-06-05
Started: 2022-10-17

Fitting delay distributions with estimate_dist()
Introduction | Set up | Simulating censored delay data | Setting priors | Fitting the model | Checking parameter recovery

Last update: 2026-05-19
Started: 2026-05-19

Model definition: estimate_dist()
Overview | Data and notation | Likelihood | Continuous formulation | Truncation | Discrete observation likelihood | Untruncated approximation | Primary event distribution | Delay families and parameterisations | Priors | References

Last update: 2026-05-19
Started: 2026-05-19

Model features
Component overview | Estimation models | Infection model | Secondary model | Truncation / nowcasting | Delay distribution fitting | Model configuration | Reproduction number | Gaussian process | Delay distributions | Observation model | Options summary | Forward simulation and forecasting | Simulation | Forecasting | Supporting utilities | Data preprocessing | Workflow wrappers | Stan backend

Last update: 2026-05-19
Started: 2026-05-07

Model overview
Introduction | Architecture | Relationship between models | Where to look next

Last update: 2026-05-19
Started: 2026-05-07

Understanding delay distributions in EpiNow2
What delay distributions represent | Specifying delays | Why naive discretisation is biased | How primarycensored corrects this | Composing multiple delays | Truncation | Fitting delay distributions from data | References

Last update: 2026-05-19
Started: 2026-05-07

Case studies and use in the literature
Case studies | Public health surveillance | Literature | By package authors | By others

Last update: 2026-05-19
Started: 2022-10-17

Model definition: estimate_secondary()

Last update: 2025-02-03
Started: 2022-10-17

Readme and manuals

Help Manual

Help pageTopics
Creates a delay distribution as the sum of two other delay distributions.+.dist_spec
Compares two delay distributions!=.dist_spec ==.dist_spec
Add breakpoints to certain dates in a data set.add_breakpoints
Convert zero case counts to 'NA' (missing) if the 7-day average is above a threshold.apply_zero_threshold
Convert EpiNow2 model output to a 'forecast_sample' objectas_forecast_sample as_forecast_sample.epinow as_forecast_sample.estimate_infections as_forecast_sample.estimate_truncation as_forecast_sample.forecast_secondary
Back Calculation Optionsbackcalc_opts
Fit a Subsampled Bootstrap to Integer Values and Summarise Distribution Parametersbootstrapped_dist_fit
Define bounds of a <dist_spec>bound_dist
Combines multiple delay distributions for further processingc.dist_spec
Calculate Credible Intervalcalc_CrI
Calculate Credible Intervalscalc_CrIs
Calculate All Summary Measurescalc_summary_measures
Calculate Summary Statisticscalc_summary_stats
Clean Nowcasts for a Supplied Dateclean_nowcasts
Clean Regionsclean_regions
Collapse nonparametric distributions in a <dist_spec>collapse collapse.dist_spec
Convert mean and sd to log mean for a log normal distributionconvert_to_logmean
Convert mean and sd to log standard deviation for a log normal distributionconvert_to_logsd
Convolve and scale a time seriesconvolve_and_scale
Delay Distribution Optionsdelay_opts
Discretise a <dist_spec>discretise discretise.dist_spec discretize
Fit an Integer Adjusted Exponential, Gamma or Lognormal distributionsdist_fit
Probability distributionsDirichlet Distributions Exp Fixed Gamma LogNormal NonParametric Normal Weibull
Real-time Rt Estimation, Forecasting and Reportingepinow
Load and compile an EpiNow2 cmdstanr modelepinow2_cmdstan_model
Estimate a Delay Distributionestimate_delay
Estimate a delay distribution using primarycensoredestimate_dist
Estimate Infections, the Time-Varying Reproduction Number and the Rate of Growthestimate_infections
Estimate a Secondary Observation from a Primary Observationestimate_secondary
Estimate truncation of observed dataestimate_truncation
Example Confirmed Case Data Setexample_confirmed
Example generation timeexample_generation_time
Example incubation periodexample_incubation_period
Example reporting delayexample_reporting_delay
Example Case Data Set with Truncationexample_truncated
Expose internal package stan functions in Rexpose_stan_fns
Extract Credible Intervals Presentextract_CrIs
Generate initial conditions from a Stan fitextract_inits
Extract all samples from a stan fitextract_samples
Extract a parameter summary from a Stan objectextract_stan_param
Fill missing data in a data set to prepare it for use within the packagefill_missing
Filter leading zeros from a data set.filter_leading_zeros
Filter Options for a Target Regionfilter_opts
Fix the parameters of a <dist_spec>fix_parameters fix_parameters.dist_spec
Forecast infections from a given fit and trajectory of the time-varying reproduction numberforecast_infections
Forecast optionsforecast_opts
Forecast Secondary Observations Given a Fit from estimate_secondaryforecast_secondary
Get the distribution of a <dist_spec>get_distribution
Get parameters from distributions or fitted modelsget_parameters get_parameters.dist_spec get_parameters.epinowfit get_parameters.estimate_dist
Get the probability mass function of a nonparametric distributionget_pmf
Get predictions from a fitted modelget_predictions get_predictions.estimate_infections get_predictions.estimate_secondary get_predictions.estimate_truncation get_predictions.forecast_infections get_predictions.forecast_secondary
Get Combined Regional Resultsget_regional_results
Get posterior samples from a fitted modelget_samples get_samples.epinow get_samples.estimate_infections get_samples.estimate_secondary get_samples.estimate_truncation get_samples.forecast_infections get_samples.forecast_secondary
Approximate Gaussian Process Settingsgp_opts
Convert Growth Rates to Reproduction numbers.growth_to_R
Generation Time Distribution Optionsgeneration_time_opts gt_opts
Check if a <dist_spec> is constrained, i.e. has a finite maximum or nonzero CDF cutoff.is_constrained is_constrained.dist_spec
Format Credible Intervalsmake_conf
Categorise the Probability of Change for Rtmap_prob_change
Returns the maximum of one or more delay distributionmax.dist_spec
Returns the mean of one or more delay distributionmean.dist_spec
Internal function for generating a 'dist_spec' given parameters and a distribution.new_dist_spec
Observation Model Optionsobs_opts
Forecast optiongopts_list
Plot EpiNow2 Credible Intervalsplot_CrIs
Plot Estimatesplot_estimates
Plot a Summary of the Latest Resultsplot_summary
Plot PMF and CDF for a dist_spec objectplot.dist_spec
Plot method for estimate_infectionsplot.estimate_infections
Plot method for estimate_secondaryplot.estimate_secondary
Plot method for estimate_truncationplot.estimate_truncation
Plot method for forecast_infectionsplot.forecast_infections
Plot method for forecast_secondary objectsplot.forecast_secondary
Prints the parameters of one or more delay distributionsprint.dist_spec
Print information about an object that has resulted from a model fit.print.epinowfit
Convert Reproduction Numbers to Growth RatesR_to_growth
Real-time Rt Estimation, Forecasting and Reporting by Regionregional_epinow
Regional Summary Outputregional_summary
Report plotsreport_plots
Provide Summary Statistics for Estimated Infections and Rtreport_summary
Time-Varying Reproduction Number Optionsrt_opts
Run epinow with Regional Processing Coderun_region
Secondary Reports Optionssecondary_opts
Setup Default Loggingsetup_default_logging
Set up Future Backendsetup_future
Setup Loggingsetup_logging
Simulate infections using the renewal equationsimulate_infections
Simulate secondary observations from primary observationssimulate_secondary
Stan Laplace algorithm Optionsstan_laplace_opts
Stan Optionsstan_opts
Stan pathfinder algorithm Optionsstan_pathfinder_opts
Stan Sampling Optionsstan_sampling_opts
Stan Variational Bayes Optionsstan_vb_opts
Summary output from epinowsummary summary.epinow
Summarise results from estimate_distsummary.estimate_dist
Summary output from estimate_infectionssummary.estimate_infections
Summarise results from estimate_secondarysummary.estimate_secondary
Summarise results from estimate_truncationsummary.estimate_truncation
Summary output from forecast_infectionssummary.forecast_infections
Truncation Distribution Optionstrunc_opts
Update estimate_secondary default priorsupdate_secondary_args