Package: epinowcast 0.3.0

Sam Abbott

epinowcast: Flexible Hierarchical Nowcasting

Tools to enable flexible and efficient hierarchical nowcasting of right-truncated epidemiological time-series using a semi-mechanistic Bayesian model with support for a range of reporting and generative processes. Nowcasting, in this context, is gaining situational awareness using currently available observations and the reporting patterns of historical observations. This can be useful when tracking the spread of infectious disease in real-time: without nowcasting, changes in trends can be obfuscated by partial reporting or their detection may be delayed due to the use of simpler methods like truncation. While the package has been designed with epidemiological applications in mind, it could be applied to any set of right-truncated time-series count data.

Authors:Sam Abbott [aut, cre], Adrian Lison [aut], Sebastian Funk [aut], Carl Pearson [aut], Hugo Gruson [aut], Felix Guenther [aut], Michael DeWitt [aut], Hannah Choi [ctb], Pratik Gupte [ctb], Joel Hellewell [ctb], Luis Rivas [ctb], Sang Woo Park [ctb], Nathan McIntosh [ctb], James Mba Azam [ctb], Kath Sherratt [ctb], Nikos Bosse [ctb]

epinowcast_0.3.0.tar.gz
epinowcast_0.3.0.zip(r-4.5)epinowcast_0.3.0.zip(r-4.4)epinowcast_0.3.0.zip(r-4.3)
epinowcast_0.3.0.tgz(r-4.4-any)epinowcast_0.3.0.tgz(r-4.3-any)
epinowcast_0.3.0.tar.gz(r-4.5-noble)epinowcast_0.3.0.tar.gz(r-4.4-noble)
epinowcast_0.3.0.tgz(r-4.4-emscripten)epinowcast_0.3.0.tgz(r-4.3-emscripten)
epinowcast.pdf |epinowcast.html
epinowcast/json (API)
NEWS

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

Peer review:

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

Pkgdown:https://package.epinowcast.org

Datasets:

On CRAN:

cmdstanreffective-reproduction-number-estimationepidemiologyinfectious-disease-surveillancenowcastingoutbreak-analysispandemic-preparednessreal-time-infectious-disease-modellingstan

8.38 score 58 stars 71 scripts 73 exports 52 dependencies

Last updated 8 months agofrom:8a9cda94d0 (on v0.3.0). Checks:OK: 1 WARNING: 6. Indexed: yes.

TargetResultDate
Doc / VignettesOKDec 14 2024
R-4.5-winWARNINGDec 14 2024
R-4.5-linuxWARNINGDec 14 2024
R-4.4-winWARNINGDec 14 2024
R-4.4-macWARNINGDec 14 2024
R-4.3-winWARNINGDec 14 2024
R-4.3-macWARNINGDec 14 2024

Exports:add_pmfscheck_max_delaycoerce_dateconvolution_matrixenw_add_cumulativeenw_add_cumulative_membershipenw_add_delayenw_add_incidenceenw_add_latest_obs_to_nowcastenw_add_max_reportedenw_add_metaobs_featuresenw_add_pooling_effectenw_aggregate_cumulativeenw_assign_groupenw_complete_datesenw_construct_dataenw_cumulative_to_incidenceenw_delay_metadataenw_designenw_effects_metadataenw_exampleenw_expectationenw_extend_dateenw_filter_delayenw_filter_reference_datesenw_filter_report_datesenw_fit_optsenw_flag_observed_observationsenw_formulaenw_formula_as_data_listenw_get_cacheenw_impute_na_observationsenw_incidence_to_cumulativeenw_incidence_to_linelistenw_latest_dataenw_linelist_to_incidenceenw_manual_formulaenw_metadataenw_metadata_delayenw_missingenw_missing_referenceenw_modelenw_nowcast_samplesenw_nowcast_summaryenw_obsenw_one_hot_encode_featureenw_plot_nowcast_quantilesenw_plot_obsenw_plot_pp_quantilesenw_plot_quantilesenw_plot_themeenw_posteriorenw_pp_summaryenw_preprocess_dataenw_priors_as_data_listenw_quantiles_to_longenw_referenceenw_replace_priorsenw_reportenw_reporting_triangleenw_reporting_triangle_to_longenw_sampleenw_score_nowcastenw_set_cacheenw_simulate_missing_referenceenw_stan_to_renw_summarise_samplesenw_unset_cacheepinowcastextract_sparse_matrixrerwsimulate_double_censored_pmf

Dependencies:abindbackportsbootcheckmateclicmdstanrcolorspacecpp11data.tabledistributionalfansifarvergenericsggplot2gluegtableisobandjsonlitelabelinglatticelifecyclelme4lubridatemagrittrMASSMatrixmatrixStatsmgcvminqamunsellnlmenloptrnumDerivpillarpkgconfigposteriorprocessxpspurrrR6RColorBrewerRcppRcppEigenrlangscalestensorAtibbletimechangeutf8vctrsviridisLitewithr

Discretised distributions

Rendered fromdistributions.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-01-03
Started: 2023-04-28

Estimating the effective reproduction number in real-time for a single timeseries with reporting delays

Rendered fromsingle-timeseries-rt-estimation.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-04-12
Started: 2023-09-05

Getting Started with Epinowcast: Nowcasting

Rendered fromepinowcast.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-04-12
Started: 2023-11-22

Hierarchical nowcasting of age stratified COVID-19 hospitalisations in Germany

Rendered fromgermany-age-stratified-nowcasting.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-04-12
Started: 2021-11-01

Model definition and implementation

Rendered frommodel.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-01-03
Started: 2021-11-04

Resources to help with model fitting using Stan

Rendered fromstan-help.Rmdusingknitr::rmarkdownon Dec 14 2024.

Last update: 2024-01-03
Started: 2023-12-13

Readme and manuals

Help Manual

Help pageTopics
Add maximum observed delayadd_max_observed_delay
Add probability mass functionsadd_pmfs
Internal function to perform rolling sum aggregationaggregate_rolling_sum
Converts formulas to stringsas_string_formula
Check calendar timestepcheck_calendar_timestep
Check observations for reserved grouping variablescheck_group
Check observations for uniqueness of grouping variables with respect to 'reference_date' and 'report_date'check_group_date_unique
Check appropriateness of maximum delaycheck_max_delay
Check a model module contains the required componentscheck_module
Check that model modules have compatible specificationscheck_modules_compatible
Check Numeric Timestepcheck_numeric_timestep
Check observation indicatorcheck_observation_indicator
Check required quantiles are presentcheck_quantiles
Check timestepcheck_timestep
Check timestep by datecheck_timestep_by_date
Check timestep by groupcheck_timestep_by_group
Coerce Datescoerce_date
Coerce 'data.table'scoerce_dt
Constructs random effect termsconstruct_re
Constructs random walk termsconstruct_rw
Construct a convolution matrixconvolution_matrix
Convert date column to numeric and calculate its modulus with given timestep.date_to_numeric_modulus
Calculate cumulative reported cases from incidence of new reportsenw_add_cumulative
Add a cumulative membership effect to a 'data.frame'enw_add_cumulative_membership
Add a delay variable to the observationsenw_add_delay
Calculate incidence of new reports from cumulative reportsenw_add_incidence
Add latest observations to nowcast outputenw_add_latest_obs_to_nowcast
Add the maximum number of reported cases for each 'reference_date'enw_add_max_reported
Add common metadata variablesenw_add_metaobs_features
Add a pooling effect to model design metadataenw_add_pooling_effect
Aggregate observations over a given timestep for both report and reference dates.enw_aggregate_cumulative
Assign a group to each row of a data.tableenw_assign_group
Complete missing reference and report datesenw_complete_dates
Construct preprocessed dataenw_construct_data
A helper function to construct a design matrix from a formulaenw_design
Extracts metadata from a design matrixenw_effects_metadata
Load a package exampleenw_example
Expectation model moduleenw_expectation
Extend a time series with additional datesenw_extend_date
Filter by reference datesenw_filter_reference_dates
Filter by report datesenw_filter_report_dates
Format model fitting options for use with stanenw_fit_opts
Flag observed observationsenw_flag_observed_observations
Define a model using a formula interfaceenw_formula
Format formula data for use with stanenw_formula_as_data_list
Retrieve Stan cache locationenw_get_cache
Impute NA observationsenw_impute_na_observations
Convert Aggregate Counts (Incidence) to a Line Listenw_incidence_to_linelist
Filter observations to the latest available reportedenw_latest_data
Convert a Line List to Aggregate Counts (Incidence)enw_linelist_to_incidence
Define a model manually using fixed and random effectsenw_manual_formula
Extract metadata from raw dataenw_metadata
Calculate reporting delay metadata for a given maximum delayenw_metadata_delay
Missing reference data model moduleenw_missing
Extract reports with missing reference datesenw_missing_reference
Load and compile the nowcasting modelenw_model
Extract posterior samples for the nowcast predictionenw_nowcast_samples
Summarise the posterior nowcast predictionenw_nowcast_summary
Setup observation model and dataenw_obs
One-hot encode a variable and column-bind it to the original data.tableenw_one_hot_encode_feature
Plot nowcast quantilesenw_plot_nowcast_quantiles
Generic quantile plotenw_plot_obs
Plot posterior prediction quantilesenw_plot_pp_quantiles
Generic quantile plotenw_plot_quantiles
Package plot themeenw_plot_theme
Summarise the posteriorenw_posterior
Posterior predictive summaryenw_pp_summary
Preprocess observationsenw_preprocess_data
Convert prior 'data.frame' to listenw_priors_as_data_list
Convert summarised quantiles from wide to long formatenw_quantiles_to_long
Reference date logit hazard reporting model moduleenw_reference
Construct a lookup of references dates by reportenw_reference_by_report
Replace default priors with user specified priorsenw_replace_priors
Report date logit hazard reporting model moduleenw_report
Construct the reporting triangleenw_reporting_triangle
Recast the reporting triangle from wide to long formatenw_reporting_triangle_to_long
Identify report dates with complete (i.e up to the maximum delay) reference datesenw_reps_with_complete_refs
Fit a CmdStan model using NUTSenw_sample
Evaluate nowcasts using proper scoring rulesenw_score_nowcast
Set caching location for Stan modelsenw_set_cache
Simulate observations with a missing reference date.enw_simulate_missing_reference
Expose 'epinowcast' stan functions in Renw_stan_to_r
Summarise posterior samplesenw_summarise_samples
Unset Stan cache locationenw_unset_cache
Nowcast using partially observed dataepinowcast
Extract observation metadataextract_obs_metadata
Extract sparse matrix elementsextract_sparse_matrix
Hospitalisations in Germany by date of report and referencegermany_covid19_hosp
Get internal timestepget_internal_timestep
Check an object is a Dateis.Date
Convert latest observed data to a matrixlatest_obs_as_matrix
Parse a formula into componentsparse_formula
Plot method for epinowcastplot.epinowcast
Defines random effect terms using the lme4 syntaxre
Remove profiling statements from a character vector representing stan coderemove_profiling
Remove random walk terms from a formula objectremove_rw_terms
Adds random walks with Gaussian steps to the model.rw
Finds random walk terms in a formula objectrw_terms
Simulate daily double censored PMFsimulate_double_censored_pmf
Split formula into individual termssplit_formula_to_terms
Read in a stan function file as a character stringstan_fns_as_string
Summary method for epinowcastsummary.epinowcast
Write copies of the .stan files of a Stan model and its #include files with all profiling statements removed.write_stan_files_no_profile