baselinenowcast0.2.0 package

Baseline Nowcasting for Right-Truncated Epidemiological Data

allocate_reference_times

Allocate training volume based on combination of defaults and user-spe...

apply_delay

Apply the delay to generate a point nowcast

apply_reporting_structure

Apply reporting structure to generate a single retrospective reporting...

apply_reporting_structures

Apply reporting structures to generate retrospective reporting triangl...

as_ChainLadder_triangle

Convert reporting_triangle to ChainLadder triangle format

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

Create a reporting_triangle object

as_reporting_triangle.triangle

Convert ChainLadder triangle to reporting_triangle format

as.data.frame.reporting_triangle

Convert reporting_triangle to data.frame

as.matrix.reporting_triangle

Convert reporting_triangle to plain matrix

assert_baselinenowcast_df

Assert validity of baselinenowcast_df objects

assert_delays_unit

Validate each item in the reporting triangle

assert_reporting_triangle

Assert validity of reporting_triangle objects

baselinenowcast_df-class

Nowcast Data.frame Object

baselinenowcast.data.frame

Create a dataframe of nowcast results from a dataframe of cases indexe...

baselinenowcast

Generate a nowcast

baselinenowcast.reporting_triangle

Create a dataframe of nowcast results from a single reporting triangle

combine_obs_with_pred

Combine observed data with a single prediction draw

dot-add_days

Internal: Add days to dates

dot-add_months

Internal: Add months to dates

dot-add_weeks

Internal: Add weeks to dates

dot-add_years

Internal: Add years to dates

dot-apply_mask

Apply mask to extract the elements of the matrix that are both true

dot-assign_allocation_from_ns

Assign number of reference times to delay and uncertainty from the siz...

dot-calc_expectation

Calculate the updated rows of the expected nowcasted triangle

dot-calc_n_retro_nowcast_times

Calculate the number of retrospective nowcast times that can be used a...

dot-calculate_ns

Helper function to calculate various size requirements

dot-check_against_requirements

Check target size against number of reference times available and the ...

dot-check_lhs_not_only_zeros

Check if there are non-zero-values on the LHS of NAs

dot-check_na_bottom_right

Check if matrix has valid NA pattern

dot-check_obs_and_pred

Check observations and predictions are compatible

dot-combine_triangle_dfs

Combine triangle data.frames

dot-compute_complete_row_stats

Compute complete row statistics

dot-compute_nowcast_stats

Compute nowcast requirement statistics

dot-compute_quantile_delay_stats

Compute quantile delay statistics for complete rows

dot-compute_zero_stats

Compute zero value statistics

dot-count_negative_rows

Count rows with negative values

dot-diff_days

Internal: Compute day difference between dates

dot-diff_months

Internal: Compute month difference between dates

dot-diff_weeks

Internal: Compute week difference between dates

dot-diff_years

Internal: Compute year difference between dates

dot-display_triangle_basics

Display basic triangle information

dot-extract_predictions

Extract from one matrix only elements that are missing in another

dot-filter_to_recent_horizons

Filter to recent horizons

dot-format_reference_date_range

Get formatted reference date range string

dot-get_triangle_info

Get triangle dimension information

dot-handle_target_exceeds_avail

Helper for when target exceeds available reference times

dot-perform_allocation_process

Perform the allocation process

dot-rename_cols

Rename required columns

dot-safelydoesit

Safe iterator

dot-split_df_by_cols

Split dataframe into a list of dataframes by the entries in the specif...

dot-update_triangle_matrix

Update reporting_triangle with new matrix data

dot-validate_delay_and_triangle

Validate triangle to nowcast and delay PMF together Various checks to ...

dot-validate_delay

Validate the delay PMF if it is passed in

dot-validate_for_delay_estimation

Validate reporting_triangle for delay estimation Domain-specific check...

dot-validate_inputs_allocation

Helper function to validate allocation parameters

dot-validate_inputs_uncertainty

Validate the specified number of reference times meets the minimum req...

dot-validate_multiple_inputs

Validate the inputs to estimate_and_apply_uncertainty() to ensure th...

dot-validate_rep_tri_args

Validate reporting_triangle constructor arguments

dot-validate_rep_tri_df

Validate the reporting triangle data.frame

dot-validate_strata_cols

Validate each of the strata columns passed to baselinenowcast

dot-validate_uncertainty

Validate the uncertainty parameters if they are passed in

estimate_and_apply_delay

Estimate and apply delay from a reporting triangle

estimate_and_apply_delays

Estimate and apply delays to generate retrospective nowcasts

estimate_and_apply_uncertainty

Estimate and apply uncertainty to a point nowcast matrix

estimate_delay

Estimate a delay distribution from a reporting triangle

estimate_uncertainty_retro

Estimate uncertainty parameters using retrospective nowcasts

estimate_uncertainty

Estimate uncertainty parameters

fit_by_horizon

Helper function that fits its each column of the matrix (horizon) to a...

fit_nb

Fit a negative binomial to a vector of observations and expectations

get_delays_from_dates

Compute delays between report dates and reference dates

get_delays_unit

Get delays unit from a reporting triangle

get_max_delay

Get maximum delay from reporting_triangle

get_mean_delay

Get mean delay for each row of reporting_triangle

get_quantile_delay

Get quantile delay for each row of reporting_triangle

get_reference_dates

Get reference dates from reporting_triangle

get_report_dates

Compute report dates from reference dates and delays

get_reporting_structure

Get reporting structure from a reporting triangle

head.reporting_triangle

Get first rows of a reporting_triangle

is_reporting_triangle

Check if an object is a reporting_triangle

new_baselinenowcast_df

Combine data from a nowcast dataframe, strata, and reference dates

new_reporting_triangle

Class constructor for reporting_triangle objects

preprocess_negative_values

Preprocess negative values in the reporting triangle

print.reporting_triangle

Print a reporting_triangle object

reporting_triangle-class

Reporting Triangle Object

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 v...

sample_nowcasts

Generate multiple draws of a nowcast combining observed and predicted ...

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 th...

sub-.reporting_triangle

Subset reporting_triangle objects

subset-.reporting_triangle

Subset assignment for reporting_triangle objects

summary.reporting_triangle

Summarize a reporting_triangle object

tail.reporting_triangle

Get last rows of a reporting_triangle

truncate_to_delay

Truncate reporting triangle to a specific maximum delay

truncate_to_quantile

Truncate reporting_triangle to quantile-based maximum delay

truncate_to_row

Truncate reporting triangle by removing a specified number of the last...

truncate_to_rows

Truncate reporting triangle by removing bottom rows

validate_reporting_triangle

Validate a reporting_triangle object

Nowcasting right-truncated epidemiological data is critical for timely public health decision-making, as reporting delays can create misleading impressions of declining trends in recent data. This package provides nowcasting methods based on using empirical delay distributions and uncertainty from past performance. It is also designed to be used as a baseline method for developers of new nowcasting methods. For more details on the performance of the method(s) in this package applied to case studies of COVID-19 and norovirus, see our recent paper at <https://wellcomeopenresearch.org/articles/10-614>. The package supports standard data frame inputs with reference date, report date, and count columns, as well as the direct use of reporting triangles, and is compatible with 'epinowcast' objects. Alongside an opinionated default workflow, it has a low-level pipe-friendly modular interface, allowing context-specific workflows. It can accommodate a wide spectrum of reporting schedules, including mixed patterns of reference and reporting (daily-weekly, weekly-daily). It also supports sharing delay distributions and uncertainty estimates between strata, as well as custom uncertainty models and delay estimation methods.

  • Maintainer: Kaitlyn Johnson
  • License: MIT + file LICENSE
  • Last published: 2026-02-03