Package: baselinenowcast 0.2.1000

Kaitlyn Johnson

baselinenowcast: Baseline Nowcasting for Right-Truncated Epidemiological Data

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 Johnson (2025) <doi:10.12688/wellcomeopenres.25027.2>. 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.

Authors:Kaitlyn Johnson [aut, cre, cph], Emily Tyszka [aut], Johannes Bracher [aut], Sebastian Funk [aut], Sam Abbott [aut], Tim Taylor [ctb]

baselinenowcast_0.2.1000.tar.gz
baselinenowcast_0.2.1000.zip(r-4.7)baselinenowcast_0.2.1000.zip(r-4.6)baselinenowcast_0.2.1000.zip(r-4.5)
baselinenowcast_0.2.1000.tgz(r-4.6-any)baselinenowcast_0.2.1000.tgz(r-4.5-any)
baselinenowcast_0.2.1000.tar.gz(r-4.7-any)baselinenowcast_0.2.1000.tar.gz(r-4.6-any)
baselinenowcast_0.2.1000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
baselinenowcast/json (API)

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

Bug tracker:https://github.com/epinowcast/baselinenowcast/issues

Pkgdown/docs site:https://baselinenowcast.epinowcast.org

Datasets:
  • example_downward_corr_rt - Example reporting triangle with downward corrections
  • example_reporting_triangle - Simple example reporting triangle for demonstrations
  • 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 - Synthetic data containing daily case counts by reference and report date
  • 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.

On CRAN:

Conda:

8.03 score 10 stars 21 scripts 202 downloads 42 exports 9 dependencies

Last updated from:afcf4a3d7a (on v0.2.1). Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK289
source / vignettesOK463
linux-release-x86_64OK288
macos-release-arm64OK215
macos-oldrel-arm64OK202
windows-develOK326
windows-releaseOK282
windows-oldrelOK297
wasm-releaseOK139

Exports:allocate_reference_timesapply_delayapply_reporting_structureapply_reporting_structuresas_ChainLadder_triangleas_reporting_triangleas_reviser_vintagesassert_baselinenowcast_dfassert_reporting_trianglebaselinenowcastcombine_obs_with_predestimate_and_apply_delayestimate_and_apply_delaysestimate_and_apply_uncertaintyestimate_delayestimate_uncertaintyestimate_uncertainty_retrofit_by_horizonfit_nbget_delays_from_datesget_delays_unitget_max_delayget_mean_delayget_quantile_delayget_reference_datesget_report_datesget_reporting_structureis_reporting_trianglenew_baselinenowcast_dfnew_reporting_trianglepreprocess_negative_valuessample_nbsample_nowcastsample_nowcastssample_predictionsample_predictionstruncate_to_datetruncate_to_delaytruncate_to_quantiletruncate_to_rowtruncate_to_rowsvalidate_reporting_triangle

Dependencies:backportscheckmatecligluelifecyclemagrittrpurrrrlangvctrs

Example nowcast performance evaluation for model specification
Packages | Data | Evaluating across a range of nowcast dates | Set the maximum delay | Specify a single model | Looping over multiple nowcast dates | Visual comparison of nowcasts | Evaluation of nowcast performance using scoringutils | Choosing a model specification using quantitative performance evaluation | Summarise performance by model specification | Interpreting the results | Summary

Last update: 2026-06-16
Started: 2026-06-16

Getting Started with baselinenowcast
Introduction | Packages | Data | Pre-processing | Run the baselinenowcast workflow | Visualizing the nowcast | Plot with draws for nowcast only | Add nowcast draws as thin gray lines | Add observed data and final data once | Summary

Last update: 2026-06-16
Started: 2025-01-29

Nowcasting syndromic surveillance system data: a case study applied to the U.S. National Syndromic Surveillance Program (NSSP) data
Introduction | About syndromic surveillance system data | Load packages | NSSP data pre-processing | Load in the line list data | Define the "syndrome" definition | Expand the diagnosis code and their corresponding time stamps into a long dataframe | Remove cases where the diagnoses code was reported before the visit start date by more than 24 hours | Obtain counts of cases by reference date (visit date) and report date (time of first diagnosis) | Pre-processing of larger synthetic dataset | Exploratory data analysis to identify an appropriate maximum delay | Format for baselinenowcast | Specify the baselinenowcast model | Run the baselinenowcast workflow | Summarise and plot the nowcast | Plot nowcast against later observed "final" data | Add observed data and final data once | Summary

Last update: 2026-06-16
Started: 2025-10-08

Modular workflow demonstration
Introduction | Packages | Data | Model specification | Pre-processing | Estimate delay | Apply the delay to generate a point nowcast | Create plot with data type as a variable | Estimate uncertainty | Generate probabilistic nowcast | Visualizing the nowcast | Plot with draws for nowcast only | Add nowcast draws as thin gray lines | Add observed data and final data once | Summary

Last update: 2026-01-27
Started: 2025-11-13

Mathematical methods for baselinenowcast
Overview | Notation | Pre-processing of the reporting triangle | Delay distribution estimation | Estimating the delay distribution from a reporting matrix | Estimating the delay distribution from a reporting triangle | Point nowcast generation | Uncertainty quantification | Generation of retrospective reporting triangles | Generation of retrospective point nowcast matrices | Fit an observation model to past nowcast errors | Probabilistic nowcast generation | Predicted probabilistic nowcast generation | Combine with observations to obtain probabilistic nowcasts | Zero-handling strategy | Default settings | References

Last update: 2025-12-22
Started: 2025-03-04

Nowcasting nomenclature

Last update: 2025-07-28
Started: 2025-07-01

Readme and manuals

Help Manual

Help pageTopics
Subset reporting_triangle objects[.reporting_triangle
Subset assignment for reporting_triangle objects[<-.reporting_triangle
Allocate training volume based on combination of defaults and user-specified values for training volume for delay and uncertainty estimation.allocate_reference_times
Apply the delay to generate a point nowcastapply_delay
Apply reporting structure to generate a single retrospective reporting triangleapply_reporting_structure
Apply reporting structures to generate retrospective reporting trianglesapply_reporting_structures
Convert reporting_triangle to ChainLadder triangle formatas_ChainLadder_triangle
Convert a 'baselinenowcast_df' object to a 'forecast_point' objectas_forecast_point.baselinenowcast_df
Convert a 'baselinenowcast_df' object to a 'forecast_sample' objectas_forecast_sample.baselinenowcast_df
Create a 'reporting_triangle' objectas_reporting_triangle
Create a 'reporting_triangle' object from a data.frameas_reporting_triangle.data.frame
Create a 'reporting_triangle' from a matrixas_reporting_triangle.matrix
Convert reviser vintages to reporting_triangle formatas_reporting_triangle.tbl_pubdate
Convert ChainLadder triangle to reporting_triangle formatas_reporting_triangle.triangle
Convert reporting_triangle to reviser vintages formatas_reviser_vintages
Convert reporting_triangle to data.frameas.data.frame.reporting_triangle
Convert reporting_triangle to plain matrixas.matrix.reporting_triangle
Assert validity of 'baselinenowcast_df' objectsassert_baselinenowcast_df
Assert validity of 'reporting_triangle' objectsassert_reporting_triangle
Generate a nowcastbaselinenowcast
Nowcast Data.frame Objectbaselinenowcast_df baselinenowcast_df-class
Create a dataframe of nowcast results from a dataframe of cases indexed by reference date and report datebaselinenowcast.data.frame
Create a dataframe of nowcast results from a single reporting trianglebaselinenowcast.reporting_triangle
Combine observed data with a single prediction drawcombine_obs_with_pred
Estimate and apply delay from a reporting triangleestimate_and_apply_delay
Estimate and apply delays to generate retrospective nowcastsestimate_and_apply_delays
Estimate and apply uncertainty to a point nowcast matrixestimate_and_apply_uncertainty
Estimate a delay distribution from a reporting triangleestimate_delay
Estimate uncertainty parametersestimate_uncertainty
Estimate uncertainty parameters using retrospective nowcastsestimate_uncertainty_retro
Example reporting triangle with downward correctionsexample_downward_corr_rt
Simple example reporting triangle for demonstrationsexample_reporting_triangle
Helper function that fits its each column of the matrix (horizon) to an observation model.fit_by_horizon
Fit a negative binomial to a vector of observations and expectationsfit_nb
Incident COVID-19 hospitalisations indexed by the date of positive test (reference date) and report date from Germany in 2021 and 2022.germany_covid19_hosp
Compute delays between report dates and reference datesget_delays_from_dates
Get delays unit from a reporting triangleget_delays_unit
Get maximum delay from reporting_triangleget_max_delay
Get mean delay for each row of reporting_triangleget_mean_delay
Get quantile delay for each row of reporting_triangleget_quantile_delay
Get reference dates from reporting_triangleget_reference_dates
Compute report dates from reference dates and delaysget_report_dates
Get reporting structure from a reporting triangleget_reporting_structure
Get first rows of a reporting_trianglehead.reporting_triangle
Check if an object is a reporting_triangleis_reporting_triangle
Combine data from a nowcast dataframe, strata, and reference datesnew_baselinenowcast_df
Class constructor for 'reporting_triangle' objectsnew_reporting_triangle
Preprocess negative values in the reporting trianglepreprocess_negative_values
Print a reporting_triangle objectprint.reporting_triangle
Reporting Triangle Objectreporting_triangle reporting_triangle-class
Sample from negative binomial model given a set of predictionssample_nb
Generate a single draw of a nowcast combining observed and predicted valuessample_nowcast
Generate multiple draws of a nowcast combining observed and predicted valuessample_nowcasts
Get a draw of only the predicted elements of the nowcast vectorsample_prediction
Get a dataframe of multiple draws of only the predicted elements of the nowcast vectorsample_predictions
Summarize a reporting_triangle objectsummary.reporting_triangle
Synthetic data containing daily case counts by reference and report datesyn_nssp_df
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.syn_nssp_line_list
Get last rows of a reporting_triangletail.reporting_triangle
Truncate reporting triangle to a reference datetruncate_to_date
Truncate reporting triangle to a specific maximum delaytruncate_to_delay
Truncate reporting_triangle to quantile-based maximum delaytruncate_to_quantile
Truncate reporting triangle by removing a specified number of the last rowstruncate_to_row
Truncate reporting triangle by removing bottom rowstruncate_to_rows
Validate a reporting_triangle objectvalidate_reporting_triangle