CasesSeries: Create a training set (data.frame) from a time series using a...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/preprocess.R

Description

Create a training set (data.frame) from a time series using a sliding window.

Usage

1
CasesSeries(t, W, start = 1, end = length(t))

Arguments

t

a time series (numeric vector).

W

a sliding window (with time lags, numeric vector).

start

starting period.

end

ending period.

Details

Check reference for details.

Value

Returns a data.frame, where y is the output target and the inputs are the time lags.

Author(s)

Paulo Cortez http://www3.dsi.uminho.pt/pcortez

References

See Also

fit, lforecast, predict.fit.

Examples

1
2
3
4
5
t=1:20
d=CasesSeries(1:10,c(1,3,4))
print(d)
d=CasesSeries(1:10,c(1,2,3))
print(d)

Example output

  lag4 lag3 lag1  y
1    1    2    4  5
2    2    3    5  6
3    3    4    6  7
4    4    5    7  8
5    5    6    8  9
6    6    7    9 10
  lag3 lag2 lag1  y
1    1    2    3  4
2    2    3    4  5
3    3    4    5  6
4    4    5    6  7
5    5    6    7  8
6    6    7    8  9
7    7    8    9 10

rminer documentation built on Dec. 16, 2019, 5:41 p.m.