Description Usage Arguments Details Value Note See Also Examples
Compute a lagged version of a time series by shifting observation values.
1 2 |
x |
a |
k |
the number of lags (in units of observations). |
... |
further arguments passed to or from methods. |
Each observation time-value tuple (t[n], x[n]) in the original time series is replaced by (t[n], x[n-k]) in the lagged time series. Observations without corresponding un-lagged value (for example, the second observation for lag k=3
) are dropped from the output.
A "uts"
object with the same observation times (apart from dropped observations) as x
.
For an evenly spaced time series (1) shifting observation times, and (2) shifting observation values essentinally gives the same result. For unevenly spaced time series, however, these two operations are quite different. The former affects only the observation times, while the latter affects only the observation values (apart from observations that are dropped).
lag_t
allows to shift observation times, as opposed to observation values.
lag
in base R.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.