Lag does exactly the opposite, shifting the time base backwards by the given number of observations. The number of lags. For lagthis is the number of time lag serien that the series is shifted forwardwhile for Lag it is the number of periods that the series is shifted backwards.
For code lagseach element gives a number of periods by which x is to be shifted forwardwhile for Lagseach element gives a number of periods by which x is to be shifted backwards. For lagscolumn names are constructed as follows: If name is supplied and has as many elements as x has columns, those names are used as the base column names.
Otherwise the column names of x comprise the base column names, or if those don't exist, the first ncols x letters of the alphabet are used as base names. Each column of the returned series has a name consisting of the basename plus a suffix indicating the lag number for that column.
Both functions return a time series ts or tis object. If the lags argument to the lags function argument has more than one element, the returned object will have a column for each lag, with NA 's filling in where appropriate. Value Both functions return a time series ts or tis object.
A vector or matrix or univariate or multivariate time series including tis series.