Skip to contents

This function reads a probabilistic ("quantile") forecast csv file and prepares it for the to_signal function and downstream plausibility analysis. The quantile forecast file can be either a "legacy" or "hubverse" format (see Details for more information). The object returned is a tibble with summarized forecast data (i.e., prediction interval) for each location and horizon in the original file.

Usage

read_forecast(file, pi_width = 95, format = "legacy")

Arguments

file

Path to csv file containing quantile forecasts

pi_width

Width of prediction interval as integer; default 95 corresponds to 95% prediction interval

format

Format of the probabilistic format file; must be one of "legacy" or "hubverse" (see Details for more information); default is "legacy"

Value

A tibble with the following columns:

  • location: Geographic unit such as FIPS code

  • date: Date corresponding the forecast horizon

  • horizon: Forecast horizon

  • lower: Lower limit of the prediction interval for the forecast

  • point: Point estimate for the forecast

  • upper: Upper limit of the prediction interval for the forecast

Details

The probabilistic forecast format has been used by multiple forecasting hubs. In general, this format includes one row per combination of quantile, location, target, and horizon. At each row the forecasted value is provided. The specific format, including columns required, has changed over time. This function accommodates the "legacy" as well as more recent "hubverse" formats. For more details on specific columns and see the links in the References.

Examples

## read in example forecast and prep forecast signal (legacy format)
fp <- system.file("extdata/forecast/2022-10-31-SigSci-TSENS.csv", package = "rplanes")
read_forecast(fp)

fp2 <- system.file("extdata/forecast/2023-11-04-SigSci-TSENS.csv", package = "rplanes")
read_forecast(fp2, format = "hubverse")