get_test_data: Get test data for prediction based on longest lag period

View source: R/get_test_data.R

get_test_dataR Documentation

Get test data for prediction based on longest lag period

Description

Based on the longest lag period in the recipe, get_test_data() creates an epi_df with columns geo_value, time_value and other variables in the original dataset, which will be used to create features necessary to produce forecasts.

Usage

get_test_data(recipe, x)

Arguments

recipe

A recipe object.

x

An epi_df. The typical usage is to pass the same data as that used for fitting the recipe.

Details

The minimum required (recent) data to produce a forecast is equal to the maximum lag requested (on any predictor) plus the longest horizon used if growth rate calculations are requested by the recipe. This is calculated internally.

Value

An object of the same type as x with columns geo_value, time_value, any additional keys, as well other variables in the original dataset.

Examples

# create recipe
rec <- epi_recipe(covid_case_death_rates) %>%
  step_epi_ahead(death_rate, ahead = 7) %>%
  step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
  step_epi_lag(case_rate, lag = c(0, 7, 14))
get_test_data(recipe = rec, x = covid_case_death_rates)

cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.