rolling_origin_nested: Rolling Origin Forecast Resampling with Irregular Timeslices

Description Usage Arguments Details

View source: R/rsample_utils.R

Description

Wrapper around rsample::rolling_origin() used to facilitate resampling of irregular time slices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
rolling_origin_nested(
  data,
  time_var,
  start = NULL,
  end = NULL,
  unit = "day",
  extend = FALSE,
  assess = 1,
  skip = 0,
  round_fun = lubridate::floor_date,
  ...
)

Arguments

data

Data to use for training and prediction.

time_var

A character. Name of date/time variable in data.

start

A character. Defines maximum date for observations in the analysis group of the first split. If NULL, then min(time_var) + assess

end

A character. Defines maximum date/time in the assessment group of the last split. If NULL then end = max(time_var).

unit

A character string specifying a time unit or a multiple of a unit to nest the data. Valid base units are second, minute, hour, day, week, month, and year. Arbitrary unique English abbreviations as in the period() constructor are allowed. Rounding to multiple of units (except weeks) is supported.

extend

A logical. If TRUE, when assess > 1 then all observations will be predicted assess number of times. For example, if data has 10 observations after nesting by time_var, assess = 2, all observations will be predicted 2 times when extend = TRUE, whereas when extend = FALSE observations 10 and 3 (the default start) will be predicted only once.

assess

The number of nested date/times used for each assessment resample.

skip

A integer indicating how many (if any) additional resamples to skip to thin the total amount of data points in the analysis resample.

round_fun

One of floor_date, ceiling_date, or round_date from the lubridate package. Default is to use floor_date. This argument controls how time_var is binned into time chunks. See ?lubridate::floor_date.

...

Other arguments passed to rsample::rolling_origin().

Details

Observations missing time_var are preserved and predicted last.


gacolitti/tidyroll documentation built on Sept. 13, 2020, 8 p.m.