read_forecast | R Documentation |
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.
read_forecast(file, pi_width = 95, format = "legacy")
file |
Path to csv file containing quantile forecasts |
pi_width |
Width of prediction interval as integer; default |
format |
Format of the probabilistic format file; must be one of |
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.
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
Hubverse: https://hubdocs.readthedocs.io/en/latest/user-guide/model-output.html
Legacy: https://github.com/cdcepi/Flusight-forecast-data/tree/master/data-forecasts#forecast-file-format
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.