Simply converts the predictions of forecasters submitting to the COVID Hub to the format of a predictions card, so it can be easily evaluated and compared.

get_covidhub_predictions(
  covidhub_forecaster_name = get_covidhub_forecaster_names(),
  forecast_dates = NULL,
  geo_values = "*",
  forecast_type = c("point", "quantile"),
  ahead = 1:4,
  incidence_period = c("epiweek", "day"),
  signal = c("confirmed_incidence_num", "deaths_incidence_num",
    "deaths_cumulative_num", "confirmed_admissions_covid_1d"),
  predictions_cards = NULL,
  start_date = NULL,
  end_date = NULL,
  date_filtering_function = NULL,
  verbose = FALSE,
  ...
)

Arguments

covidhub_forecaster_name

A vector of strings indicating the forecasters (matching what it is called on the COVID Hub).

forecast_dates

Vector of Date objects (or strings of the form "YYYY-MM-DD") indicating dates on which forecasts will be made. If NULL, the default, then all currently available forecast dates from the given forecaster in the COVID Hub will be used.

geo_values

vector of character strings containing FIPS codes of counties, or lower case state abbreviations (or "us" for national). The default "*" fetches all available locations

forecast_type

"quantile", "point" or both (the default)

ahead

number of periods ahead for which the forecast is required. NULL will fetch all available aheads

incidence_period

one of "epiweek" or "day". NULL will attempt to return both

signal

this function supports only "confirmed_incidence_num", "deaths_incidence_num", "deaths_cumulative_num", and/or "confirmed_admissions_covid_1d". For other types, use one of the alternatives mentioned above

predictions_cards

An object of class predicitions_cards that contains previously retrieved predictions. If provided, files will not be retrieved from Reichlab for any forecaster / forecast_date combos that are present in the file.

start_date

The earliest date for which to retrieve predictions

end_date

The latest date for which to retrieve predictions

date_filtering_function

A function which takes a list, where each element is a vector of dates and returns a list where each element is a subset of those in the original list. Used for custom filtering of dates (e.g. only forecasts from Mondays, where all forecasters made a forecast, etc.)

verbose

If TRUE, prints additional details about progress. FALSE by default.

...

Additional named arguments. Intended for expert users only.

Value

Long data frame of forecasts with a class of predictions_cards. The first 4 columns are the same as those returned by the forecaster. The remainder specify the prediction task, 10 columns in total: ahead, geo_value, quantile, value, forecaster, forecast_date, data_source, signal, target_end_date, and incidence_period. Here data_source and signal correspond to the response variable only.

For more flexible processing of COVID Hub data, try using zoltr

See also