Description Usage Arguments Details References
Generate test/train sets for time series. Each training set consists of observations before the test set. This method also called "evaluation on a rolling forecasting origin".
1 2 3 |
n |
A positive, scalar integer representing the number of observations (items to choose from). |
horizon |
Difference between the first test set observation and the last training set observation |
test_size |
A scalar integer indicating the size of the test set. |
test_partial, train_partial |
A logical scalar or positive scalar integer which
handles how partial test (train) sets are handled. If |
train_size |
The maximum size of the training set. This allows for a rolling window training set, instead of using all observations from the start of the time series. |
test_start |
An integer vector of the starting index values of the test set. |
from, to, by |
Integer scalar values used to generate values of
|
In time-series cross-validation the training set only uses observations that are prior to the test set. Suppose the time series has n observations, the training set has a maximum size of r <= n and minimum size of s >= r. and the test set has a maximum size of p <= n and minimum size of q >= p.
For indices i in {1, …, N}:
Select observations i, ..., max(p, n) for the test set.
Select observations max(i - h - p), ..., i - h for the training set.
If the test set has a size of at least q
and the training set
has a size of at least r
.
Hyndman RJ (2017). forecast: Forecasting functions for time series and linear models. R package version 8.0, URL.
Hyndman RJ and Khandakar Y (2008). "Automatic time series forecasting: the forecast package for R." Journal of Statistical Software. URL.
Rob J. Hyndman. "Cross-validation for time series". December 5, 2016.
Rob J. Hyndman. "Time series cross-validation: an R example". August 26, 2011.
Rob J. Hyndman and George Athanasopoulos. "Evaluating Forecast Accuracy." URL.
Max Kuhn. "Data splitting for Time Series." The caret Package. 2016-11-29. URL.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.