tfL
methods shift the time frame, or the time frame of the object, by
p
periods. (This might also be thought of as the exponent of the lag
operator.) Positive p
means shift the time frame forward and negative
p
means shift the time frame back. Shifting the time frame forward
means the data at a point in time is the data from the previous point in time
in the unshifted data, so the result corresponds to what is often called
the lagged data. The default p
(+1) means
the start and end for the results are one period later. When applied to a
data object, the default result is one lag of the data.
This convention is not the same as that used for k
in the
function lag
.
Note that the time frame of the data is shifted, but a vector or matrix
representation of the data is unchanged. This means that operations on the
data, such as +, -, *, and /
, need to be time aware as, for example,
operations on ts objects are. If the operations do not recognize the time
framed aspect of the objects, then the operation will be performed with
default methods that will probably have unintended results (see examples).
Differencing methods create a time frame or time framed object
by differencing the number
of times indicated by differences
at a lagged number of periods indicated
by lag
. (Positive values of lag
indicate number of periods back.)
The default is take the difference from data one period previous.
See diff
for more details, but note that the result when
applied to a time frame is a time frame, not a series.