laggedData: Create Input Matrix and Output Vector for Time Series...

Description Usage Arguments Details Value Author(s) Examples

View source: R/laggedData.R

Description

Given a time series vector, produces the input matrix and output vector for a time series prediction task. The other parameters are the lags to include and the number of steps ahead to predict.

Usage

1
laggedData(x, lags = 0:9, stepsAhead = 1)

Arguments

x

an atomic vector representing a (uniformly sampled) time series. Any attributes are ignored.

lags

which lags to use for prediction. A vector of non-negative integral values.

stepsAhead

how many steps ahead to predict. A non-negative integral value (integer or numeric).

Details

The default parameters correspond to predicting one step ahead (position t+1) using the ten most recent values (positions t ... t-9).

Value

A list with two components:

X

The (length(x) - max(lags) - stepsAhead) rows by length(lags) columns input matrix with the same type as x.

y

The output vector with length(x) - max(lags) - stepsAhead elements. Same type as x.

Author(s)

Mikko Korpela

Examples

1
laggedData(1:20)

sisal documentation built on Feb. 16, 2020, 1:07 a.m.