Skip to contents

High-level interface

Functions most users will interact with for typical nowcasting workflows.

Reporting triangle data structures

Functions for creating, converting, and validating reporting triangle objects from matrices or data frames.

as_ChainLadder_triangle()
Convert reporting_triangle to ChainLadder triangle format
as_reporting_triangle()
Create a reporting_triangle object
as_reporting_triangle(<data.frame>)
Create a reporting_triangle object from a data.frame
as_reporting_triangle(<matrix>)
Create a reporting_triangle from a matrix
as_reporting_triangle(<triangle>)
Convert ChainLadder triangle to reporting_triangle format
assert_reporting_triangle()
Assert validity of reporting_triangle objects
detect_structure()
Detect the structure of a reporting triangle
new_reporting_triangle()
Class constructor for reporting_triangle objects
reporting_triangle-class reporting_triangle
Reporting Triangle Object

Nowcast data frames

The main nowcasting interface. Functions for creating and validating nowcast data frame objects containing point or probabilistic nowcast results.

assert_baselinenowcast_df()
Assert validity of baselinenowcast_df objects
baselinenowcast()
Generate a nowcast
baselinenowcast(<data.frame>)
Create a dataframe of nowcast results from a dataframe of cases indexed by reference date and report date
baselinenowcast(<reporting_triangle>)
Create a dataframe of nowcast results from a single reporting triangle
baselinenowcast_df-class baselinenowcast_df
Nowcast Data.frame Object
new_baselinenowcast_df()
Combine data from a nowcast dataframe, strata, and reference dates

Workflow wrappers

High-level wrapper functions that combine multiple steps for end-to-end nowcasting workflows.

allocate_reference_times()
Allocate training volume based on combination of defaults and user-specified values for training volume for delay and uncertainty estimation.
estimate_and_apply_delay()
Estimate and apply delay from a reporting triangle
estimate_and_apply_uncertainty()
Estimate and apply uncertainty to a point nowcast matrix
estimate_uncertainty_retro()
Estimate uncertainty parameters using retrospective nowcasts

Lower-level components

Modular functions for building custom nowcasting workflows and advanced use cases.

Estimate delay distributions

Functions for estimating empirical delay distributions from reporting triangles.

estimate_delay()
Estimate a delay distribution from a reporting triangle
preprocess_negative_values()
Preprocess negative values in the reporting triangle

Generate retrospective data

Functions for creating retrospective reporting triangles by truncating and generating incomplete data structures for validation and uncertainty estimation.

construct_triangle()
Generate a single retrospective reporting triangle
construct_triangles()
Generate retrospective reporting triangles
truncate_triangle()
Get a single truncated triangle
truncate_triangles()
Generate truncated reporting triangles

Generate point nowcasts

Functions for applying delay distributions to incomplete reporting data to generate point nowcast estimates.

apply_delay()
Apply the delay to generate a point nowcast
fill_triangle()
Generate point nowcast
fill_triangles()
Generate retrospective nowcasts

Estimate observation error

Functions for estimating observation error parameters from retrospective nowcast performance to quantify uncertainty.

estimate_uncertainty()
Estimate uncertainty parameters
fit_by_horizon()
Helper function that fits its each column of the matrix (horizon) to an observation model.
fit_nb()
Fit a negative binomial to a vector of observations and expectations

Generate probabilistic nowcasts

Functions for generating probabilistic nowcasts by combining point estimates with uncertainty quantification from observation error models.

combine_obs_with_pred()
Combine observed data with a single prediction draw
sample_nb()
Sample from negative binomial model given a set of predictions
sample_nowcast()
Generate a single draw of a nowcast combining observed and predicted values
sample_nowcasts()
Generate multiple draws of a nowcast combining observed and predicted values
sample_prediction()
Get a draw of only the predicted elements of the nowcast vector
sample_predictions()
Get a dataframe of multiple draws of only the predicted elements of the nowcast vector

Data

Example datasets included with the package.

germany_covid19_hosp
Incident COVID-19 hospitalisations indexed by the date of positive test (reference date) and report date from Germany in 2021 and 2022.
syn_nssp_df
A synthetic dataset containing the number of incident cases indexed by reference date and report date. While data of this form could be from any source, this data is meant to represent the output of pre-processing the syn_nssp_line_list dataset, which is a synthetic patient-level line list data from the United State's National Syndromic Surveillance System (NSSP).
syn_nssp_line_list
A synthetic dataset resembling line-list (each row is a patient) data from the United States' National Syndromic Surveillance System (NSSP) accessed via the Essence platform. All entries are synthetic, formatted to look as close to the real raw data as possible.