Skip to contents

Estimation + Reporting

Functions that facilitate end-to-end analysis including imputing cases by infection, estimating Rt and reporting results.

epinow() stable
Real-time Rt Estimation, Forecasting and Reporting
epinow2_cmdstan_model()
Load and compile an EpiNow2 cmdstanr model
plot(<epinow>) maturing
Plot method for epinow
regional_epinow() maturing
Real-time Rt Estimation, Forecasting and Reporting by Region
summary(<epinow>) stable
Summary output from epinow

Estimate, Simulate, and Forecast Parameters

Function to estimate, simulate and forecast parameters of interest.

estimate_infections() maturing
Estimate Infections, the Time-Varying Reproduction Number and the Rate of Growth
forecast_infections() stable
Forecast infections from a given fit and trajectory of the time-varying reproduction number
estimate_secondary() stable
Estimate a Secondary Observation from a Primary Observation
forecast_secondary() experimental
Forecast Secondary Observations Given a Fit from estimate_secondary
estimate_delay() maturing
Estimate a Delay Distribution
estimate_truncation() stable
Estimate Truncation of Observed Data

Specify Arguments

Functions used by estimate_infections

backcalc_opts() stable
Back Calculation Options
delay_opts() stable
Delay Distribution Options
filter_opts() maturing
Filter Options for a Target Region
forecast_opts() stable
Forecast options
gt_opts() generation_time_opts() stable
Generation Time Distribution Options
gp_opts() stable
Approximate Gaussian Process Settings
obs_opts() stable
Observation Model Options
rt_opts() stable
Time-Varying Reproduction Number Options
secondary_opts() stable
Secondary Reports Options
stan_laplace_opts() experimental
Stan Laplace algorithm Options
stan_opts() stable
Stan Options
stan_pathfinder_opts() experimental
Stan pathfinder algorithm Options
stan_sampling_opts() stable
Stan Sampling Options
stan_vb_opts() stable
Stan Variational Bayes Options
trunc_opts() stable
Truncation Distribution Options
opts_list() maturing
Forecast optiong

Preprocess Data

Functions used for preprocessing data

fill_missing() experimental
Fill missing data in a data set to prepare it for use within the package
add_breakpoints()
Add breakpoints to certain dates in a data set.
filter_leading_zeros()
Filter leading zeros from a data set.
apply_zero_threshold()
Convert zero case counts to NA (missing) if the 7-day average is above a threshold.

Regional Analysis

Functions used for summarising across regions (designed for use with regional_epinow)

regional_summary() maturing
Regional Summary Output
regional_runtimes() maturing
Summarise Regional Runtimes
get_regional_results() stable
Get Combined Regional Results

Summarise Results

Functions for summarising results

summary(<epinow>) stable
Summary output from epinow
summary(<estimate_infections>) stable
Summary output from estimate_infections
backcalc_opts() stable
Back Calculation Options
calc_CrI() stable
Calculate Credible Interval
calc_CrIs() stable
Calculate Credible Intervals
calc_summary_measures() stable
Calculate All Summary Measures
calc_summary_stats() stable
Calculate Summary Statistics
make_conf() stable
Format Credible Intervals
map_prob_change() stable
Categorise the Probability of Change for Rt

Plot Results

Plot generated results

plot(<dist_spec>) experimental
Plot PMF and CDF for a dist_spec object
plot(<epinow>) maturing
Plot method for epinow
plot(<estimate_infections>) maturing
Plot method for estimate_infections
plot(<estimate_secondary>) experimental
Plot method for estimate_secondary
plot(<estimate_truncation>) experimental
Plot method for estimate_truncation
plot_CrIs() stable
Plot EpiNow2 Credible Intervals
plot_estimates() questioning
Plot Estimates
plot_summary() questioning
Plot a Summary of the Latest Results
report_plots() questioning
Report plots

Report Results

Functions to report results

report_plots() questioning
Report plots
report_summary() questioning
Provide Summary Statistics for Estimated Infections and Rt

Distribution Functions

Functions to define and parameterise distributions

LogNormal() Gamma() Normal() Fixed() NonParametric()
Probability distributions
c(<dist_spec>) experimental
Combines multiple delay distributions for further processing
collapse(<dist_spec>) experimental
Collapse nonparametric distributions in a <dist_spec>
discretise(<dist_spec>) discretize() experimental
Discretise a <dist_spec>
`==`(<dist_spec>) `!=`(<dist_spec>)
Compares two delay distributions
fix_parameters(<dist_spec>) experimental
Fix the parameters of a <dist_spec>
is_constrained(<dist_spec>) experimental
Check if a <dist_spec> is constrained, i.e. has a finite maximum or nonzero CDF cutoff.
max(<dist_spec>) experimental
Returns the maximum of one or more delay distribution
mean(<dist_spec>) experimental
Returns the mean of one or more delay distribution
new_dist_spec() experimental
Internal function for generating a dist_spec given parameters and a distribution.
plot(<dist_spec>) experimental
Plot PMF and CDF for a dist_spec object
`+`(<dist_spec>) experimental
Creates a delay distribution as the sum of two other delay distributions.
print(<dist_spec>) experimental
Prints the parameters of one or more delay distributions
bound_dist() experimental
Define bounds of a <dist_spec>
get_parameters() experimental
Get parameters of a parametric distribution
get_pmf() experimental
Get the probability mass function of a nonparametric distribution
get_distribution() experimental
Get the distribution of a <dist_spec>

Fit Delay Distributions

Functions to fit delay distributions

bootstrapped_dist_fit() stable
Fit a Subsampled Bootstrap to Integer Values and Summarise Distribution Parameters
dist_fit() stable
Fit an Integer Adjusted Exponential, Gamma or Lognormal distributions

Simulation

Functions to help with simulating data or mapping to reported cases

simulate_infections()
Simulate infections using the renewal equation
simulate_secondary()
Simulate secondary observations from primary observations
convolve_and_scale()
Convolve and scale a time series

Data

Package datasets that may be used to parameterise other functions or in examples

example_generation_time stable
Example generation time
example_incubation_period stable
Example incubation period
example_reporting_delay stable
Example reporting delay
example_confirmed stable
Example Confirmed Case Data Set
example_truncated stable
Example Case Data Set with Truncation

Data Access

Functions for extracting data from objects or getting data from sources

get_distribution() experimental
Get the distribution of a <dist_spec>
get_parameters() experimental
Get parameters of a parametric distribution
get_pmf() experimental
Get the probability mass function of a nonparametric distribution
get_regional_results() stable
Get Combined Regional Results
extract_CrIs() stable
Extract Credible Intervals Present
extract_inits() experimental
Generate initial conditions from a Stan fit
extract_samples()
Extract all samples from a stan fit
extract_stan_param() stable
Extract a Parameter Summary from a Stan Object

Data Cleaning

Functions for cleaning data

clean_nowcasts() stable
Clean Nowcasts for a Supplied Date
clean_regions() stable
Clean Regions

Setup

Functions used for setting up functionality

setup_default_logging() questioning
Setup Default Logging
setup_future() stable
Set up Future Backend
setup_logging() questioning
Setup Logging

Utilities

Utility functions

run_region() maturing
Run epinow with Regional Processing Code
expose_stan_fns() stable
Expose internal package stan functions in R
convert_to_logmean() stable
Convert mean and sd to log mean for a log normal distribution
convert_to_logsd() stable
Convert mean and sd to log standard deviation for a log normal distribution
growth_to_R() questioning
Convert Growth Rates to Reproduction numbers.
R_to_growth() questioning
Convert Reproduction Numbers to Growth Rates
update_secondary_args() stable
Update estimate_secondary default priors

Internal

EpiNow2 EpiNow2-package
EpiNow2: Estimate Real-Time Case Counts and Time-Varying Epidemiological Parameters
add_day_of_week()
Adds a day of the week vector
add_horizon()
Add missing values for future dates
allocate_delays() stable
Allocate Delays into Required Stan Format
allocate_empty() stable
Allocate Empty Parameters to a List
apply_default_cdf_cutoff()
Apply default CDF cutoff to a <dist_spec> if it is unconstrained
apply_tolerance() deprecated
Applies a threshold to all nonparametric distributions in a <dist_spec>
check_generation_time() stable
Validate probability distribution for using as generation time
check_reports_valid() stable
Validate data input
check_sparse_pmf_tail()
Check that PMF tail is not sparse
check_stan_delay() stable
Validate probability distribution for passing to stan
construct_output() stable
Construct Output
convert_to_natural() experimental
Internal function for converting parameters to natural parameters.
copy_results_to_latest() questioning
Copy Results From Dated Folder to Latest
create_backcalc_data() stable
Create Back Calculation Data
create_delay_inits()
Create initial conditions for delays
create_future_rt() stable
Construct the Required Future Rt assumption
create_gp_data() stable
Create Gaussian Process Data
create_initial_conditions() stable
Create Initial Conditions Generating Function
create_obs_model() stable
Create Observation Model Settings
create_rt_data() stable
Create Time-varying Reproduction Number Data
create_shifted_cases() stable
Create Delay Shifted Cases
create_stan_args() stable
Create a List of Stan Arguments
create_stan_data() stable
Create Stan Data Required for estimate_infections
create_stan_delays()
Create delay variables for stan
create_stan_params()
Create parameters for stan
default_fill_missing_obs() deprecated
Temporary function to support the transition to full support of missing data.
discrete_pmf() questioning
Discretised probability mass function
dist_skel() deprecated
Distribution Skeleton
epinow2_rstan_model()
Load an EpiNow2 rstan model.
epinow2_stan_model()
Return a stan model object for the appropriate backend
estimates_by_report_date() questioning
Estimate Cases by Report Date
extract_parameter() stable
Extract Samples for a Parameter from a Stan model
extract_parameter_samples() stable
Extract Parameter Samples from a Stan Model
extract_params() experimental
Extract parameter names
extract_single_dist() experimental
Extract a single element of a composite <dist_spec>
extract_static_parameter()
Extract Samples from a Parameter with a Single Dimension
fit_model()
Fit a model using the chosen backend.
fit_model_approximate() maturing
Fit a Stan Model using an approximate method
fit_model_with_nuts() maturing
Fit a Stan Model using the NUTs sampler
fix_dist() deprecated
Remove uncertainty in the parameters of a <dist_spec>
format_fit() stable
Format Posterior Samples
get_element()
Extracts an element of a <dist_spec>
get_raw_result() stable
Get a Single Raw Result
get_regions() stable
Get Folders with Results
get_regions_with_most_reports() stable
Get Regions with Most Reported Cases
get_seeding_time()
Estimate seeding time from delays and generation time
lapply_func()
Choose a parallel or sequential apply function
lower_bounds() experimental
Get the lower bounds of the parameters of a distribution
match_output_arguments() stable
Match User Supplied Arguments with Supported Options
natural_params() experimental
Get the names of the natural parameters of a distribution
ndist()
Calculate the number of distributions in a <dist_spec>
pad_reported_cases()
Pads reported cases with daily initial zeros
process_region() maturing
Process regional estimate
process_regions() stable
Process all Region Estimates
regional_runtimes() maturing
Summarise Regional Runtimes
save_estimate_infections() stable
Save Estimated Infections
save_input() stable
Save Observed Data
sd(<dist_spec>) experimental
Returns the standard deviation of one or more delay distribution
set_dt_single_thread()
Set to Single Threading
setup_dt() stable
Convert to Data Table
setup_target_folder() stable
Setup Target Folder for Saving
summarise_key_measures() maturing
Summarise rt and cases
summarise_results() questioning
Summarise Real-time Results
update_horizon() stable
Updates Forecast Horizon Based on Input Data and Target