The function `tslag` back- or foreshifts a time series and generates the lagged version of it.
Usage
tslag(x, lag = 1L, return.matrix = FALSE)
Value
The same time series object as x after being back- or foreshifted for the number of periods specified in lag.
Arguments
x
a univariate time series object.
lag
number of lags (in units of observations). Default is 1. If multiple values are given as a vector, multiple lagged version of the series will be returned as a matrix.
return.matrix
optional. A boolean value indicating whether the lagged version of `x` should be returned as a matrix. Only meaningful if lag has only one value.
Author
Ka Yui Karl Wu
Details
Note the sign of lag: a series lagged by a positive lag starts earlier.