All functions

aggregate_to_weekly()

Aggregate daily data to weekly data

align_forecasts()

Add reference dates and relative horizons to a dataframe of forecasts

align_forecasts_one_temporal_resolution()

Internal function that add reference dates and relative horizons to a dataframe of forecasts. This function requires that the forecasts data frame contains only forecasts one temporal_resolution, i.e., only at the daily resolution or the weekly resolution.

as_covid_hub_forecasts()

Reformat model outputs stored as a model_output_tbl class (or similar) to that of a data.frame formatted according to standards of the COVID-19 Forecasting Hub which can be processed by functions from the covidHubUtils package such as score_forecasts() or plot_forecasts(). The supplied model_output_tbl should have columns defining properties akin to reference dates, locations, horizons, and targets.

calc_cramers_dist_equal_space()

Approximate the Cramer’s distance between a pair of distributions F and G that are represented by a collection of equally-spaced quantiles.

calc_cramers_dist_one_model_pair()

Calculate the approximated Cramer’s distance between a pair of distributions F and G that are represented by a collection of quantiles using a specific approximation rule.

calc_cramers_dist_unequal_space()

Approximate the Cramer’s distance between a pair of distributions F and G that are represented by a collection of unequally-spaced quantiles.

calc_forecast_week_end_date()

Calculate end date for the week a forecast was made.

calc_submission_due_date()

Calculate the submission date that corresponds to a given forecast date

calc_target_end_date()

Calculate end date for a forecast is targeting.

calc_target_week_end_date()

Calculate end date for the week a forecast is targeting.

covidHubUtils covidHubUtils-package

covidHubUtils - Utility functions for the COVID-19 forecast hub

date_to_datetime()

Create a datetime by appending time and/or UTC timezone to the given date string, if necessary

date_to_week_end_date()

Calculate the date of the Saturday that ends the MMWR epidemic week for the given date,offset a specified number of epidemic week from a specified date

download_raw_nytimes()

Download historical raw truth data from NYTimes and write to CSV files. Note: updates to the NYTimes data stopped in March 2023.

get_all_models()

Get all valid model names

get_forecast_file_path()

Generate paths to forecast files submitted on a range of forecast dates from selected models

get_hub_locations()

Create data/hub_locations.rda for loading data from zoltar and covidData

get_model_designations()

Get model designations from metadata

get_model_forecast_history_local_zoltar()

Get forecast submission history of a specified model from local zoltar sqlite file

get_model_metadata()

Get Hub model metadata

get_models_local_zoltar()

Get id and abbrevations of all models available in a specified project from local zoltar sqlite file

get_plot_forecast_data()

Combine load_truth() and pivot_forecasts_wider()

get_truth_path()

Construct the file path to a truth file

get_valid_target_list()

Create data/hub_targets_us.rda and data/hub_targets_ecdc.rda

get_zoltar_project_id_local_zoltar()

Get Zoltar project id from local zoltar sqlite file

get_zoltar_project_url()

Get Zoltar project URL

hub_locations hub_locations

Information on locations in the COVID-19 Forecast Hub

hub_locations_ecdc

Available locations in the ECDC Hub

hub_locations_flusight

Available locations in the FluSight Hub

hub_targets_ecdc

Available targets in the ECDC Hub

hub_targets_flusight

Available targets in the FluSight Hub

hub_targets_us

Available targets in the US Hub

join_with_hub_locations()

Add stored information about location name and population by joining the data with the correct stored location data

load_forecast_files_repo()

Read in a set of forecast files from a repository without rows having NULLs in value column.

load_forecasts()

Load all available forecasts submitted around forecast dates from Zoltar, local Zoltar module or local hub repo.

load_forecasts_local_zoltar()

Load all available forecasts submitted on forecast_dates from local Zoltar module.

load_forecasts_repo()

Load all available forecasts submitted on forecast_dates from a local clone of reichlab/covid19-forecast-hub repo.

load_forecasts_zoltar()

Load all available forecasts submitted on forecast_dates from Zoltar.

load_from_coviddata()

load truth data from covidData

load_from_hub_repo()

load truth data from a local clone of forecast hub repo

load_latest_forecasts()

Load covid forecasts from local hub repo or Zoltar. Return the most recent forecast from each model within forecast_date_window_size days of the last_forecast_date

load_latest_forecasts_repo()

Load the most recent forecasts of all that were submitted on forecast_dates from a local clone of reichlab/covid19-forecast-hub repo.

load_latest_forecasts_zoltar()

Load the most recent forecasts of all that were submitted on forecast_dates from Zoltar.

load_truth()

Load truth data under multiple target variables from multiple truth sources

name_to_fips()

Get FIPS or CBSA codes from county or metropolitan area locations

pivot_forecasts_wider()

Return a data frame of forecasts with predictive quantiles in columns.

plot_forecast()

Plot forecasts and optional truth for only one selected target variable. Faceted plots for multiple models, locations and forecast dates are supported with specified facet formula.

plot_forecasts()

Plot forecasts and optional truth for only one selected target variable.

preprocess_hospitalization()

Preprocess raw hospitalization data into Cumulative/Incident hospitalizations and write to CSVs

preprocess_jhu()

Preprocess historical raw truth data from JHU CSSE into Cumulative/Incident - Deaths/Cases and write to CSVs. Note: updates to the JHU CSSE data stopped in March 2023.

preprocess_nytimes()

Preprocess raw truth data from NYTimes into Cumulative/Incident - Deaths/Cases and write to CSVs. Note: updates to the NYTimes data stopped in March 2023.

preprocess_visualization_truth()

Preprocess raw truth data from JHU CSSE into Cumulative/Incident - Deaths/Cases for visualization purpose and write to JSON files. Note: updates to the JHU CSSE data stopped in March 2023.

reformat_forecasts()

Reformat forecast data frame returned from zoltar query This function will throw a warning and return an empty data.frame with columns model, forecast_date, location, type, quantile and value, when no forecasts are available in zoltar_query_result.

score_forecasts()

Score forecasts

setup_zoltar_connection()

Set up Zoltar connection