Description Usage Arguments Value Examples
View source: R/get_predictions.R
For each of the provided forecast dates, runs a forecaster using the data that would have been available as of that given forecast date. Returns a list of "predictions cards", where each list element corresponds to a different forecast date. A predictions card is a data frame giving the forecast distributions of a given forecaster for a given forecast task. A forecast task is specified by the forecast date, ahead, response, incidence period, and geo type (e.g., 1-epiweek-ahead death forecasting at the state level with predictions made using the information as of September 14).
1 2 3 4 5 6 7 8 9 10 11 12 | get_predictions(
forecaster,
name_of_forecaster,
signals,
forecast_dates,
incidence_period = c("epiweek", "day"),
apply_corrections = function(signals) signals,
response_data_source = signals$data_source[1],
response_data_signal = signals$signal[1],
forecaster_args = list(),
offline_signal_dir = NULL
)
|
forecaster |
Function that outputs a tibble with columns One argument to Thus, the forecaster should have a signature like
|
name_of_forecaster |
String indicating name of the forecaster. |
signals |
Tibble with mandatory columns
A column You may also include a By default, the |
forecast_dates |
Vector of Date objects (or strings of the form "YYYY-MM-DD") indicating dates on which forecasts will be made. |
incidence_period |
String indicating the incidence period, either "epiweek" or "day". |
apply_corrections |
an optional function that applies data corrections
to the signals. Input is a data frame or list as returned as
|
response_data_source |
String indicating the |
response_data_signal |
String indicating the |
forecaster_args |
a list of additional named arguments to be passed
to |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
baby_predictions = get_predictions(
baseline_forecaster, "baby",
tibble::tibble(
data_source="jhu-csse",
signal ="deaths_incidence_num",
start_day="2020-08-15",
geo_values = "mi",
geo_type = "state"),
forecast_dates = "2020-10-01",
incidence_period = "epiweek",
forecaster_args = list(
incidence_period = "epiweek",
ahead = 1:4
))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.