prediction_data(model_data, key, index, ...)
data used in the model
new key
new index
any other variables you want to create an example dataset of
tsibble
object with the same index and key as model_data
.
Create prediction data that has the same index and key as the model data for use in prediction.
date_range <- clock::date_build(2019, 2, 1:5)
date_range
#> [1] "2019-02-01" "2019-02-02" "2019-02-03" "2019-02-04" "2019-02-05"
countries <- c("Ethiopia", "Tanzania")
countries
#> [1] "Ethiopia" "Tanzania"
prediction_data(
model_data = malaria_africa_ts,
key = countries,
index = date_range
)
#> # A tsibble: 10 x 2 [1D]
#> # Key: country [2]
#> country date
#> <chr> <date>
#> 1 Ethiopia 2019-02-01
#> 2 Ethiopia 2019-02-02
#> 3 Ethiopia 2019-02-03
#> 4 Ethiopia 2019-02-04
#> 5 Ethiopia 2019-02-05
#> 6 Tanzania 2019-02-01
#> 7 Tanzania 2019-02-02
#> 8 Tanzania 2019-02-03
#> 9 Tanzania 2019-02-04
#> 10 Tanzania 2019-02-05