Time Series Lag/Lead Function


Returns a lagged/leading timeSeries or signalSeries object.


seriesLag(X, k = 1, trim = FALSE, pad = NA)


X an object of class timeSeries or signalSeries.
k the number of positions the new time series or signal series is to lag or lead the input series, with a positive value resulting in a lagged series and a negative value resulting in a leading series.
trim a logical flag. If TRUE, the missing values at the beginning or end of the returned series will be trimmed. The default is FALSE.
pad any padding to fill in the beginning or ending missing values. The default is NA.


The difference between shift and seriesLag is that the returned series of shift is shifted in time (position) while the returned series of seriesLag shifts the entire data slot but keeps the same time (position) intact. They all work for both timeSeries and signalSeries objects.
returns a lagged or leading time (signal) series of the original data.
See Also
lag, shift .
x <- timeSeries(data=data.frame(x=1:10, y=11:20),
    from="7/4/2000", by="bizdays")
seriesLag(x, 1)
seriesLag(x, -1)
Package splusTimeSeries version 6.0.0-68
Package Index