Time Series Resample Plan Data Preparation
Source:R/rsample-tk_time_series_cv_plan.R
tk_time_series_cv_plan.Rd
The tk_time_series_cv_plan()
function provides a simple interface to
prepare a time series resample specification (rset
) of either rolling_origin
or time_series_cv
class.
Arguments
- .data
A time series resample specification of of either
rolling_origin
ortime_series_cv
class.
Details
Resample Set
A resample set is an output of the timetk::time_series_cv()
function or the
rsample::rolling_origin()
function.
See also
time_series_cv()
andrsample::rolling_origin()
- Functions used to create time series resample specfications.plot_time_series_cv_plan()
- The plotting function used for visualizing the time series resample plan.
Examples
library(dplyr)
library(rsample)
FB_tbl <- FANG %>%
filter(symbol == "FB") %>%
select(symbol, date, adjusted)
resample_spec <- time_series_cv(
FB_tbl,
initial = 150, assess = 50, skip = 50,
cumulative = FALSE,
lag = 30,
slice_limit = n())
#> Using date_var: date
resample_spec %>% tk_time_series_cv_plan()
#> # A tibble: 3,910 × 5
#> .id .key symbol date adjusted
#> <chr> <fct> <chr> <date> <dbl>
#> 1 Slice01 training FB 2016-03-18 111.
#> 2 Slice01 training FB 2016-03-21 112.
#> 3 Slice01 training FB 2016-03-22 112.
#> 4 Slice01 training FB 2016-03-23 113.
#> 5 Slice01 training FB 2016-03-24 113.
#> 6 Slice01 training FB 2016-03-28 114.
#> 7 Slice01 training FB 2016-03-29 116.
#> 8 Slice01 training FB 2016-03-30 115.
#> 9 Slice01 training FB 2016-03-31 114.
#> 10 Slice01 training FB 2016-04-01 116.
#> # ℹ 3,900 more rows