lagmatrix: Create lead/lags of a variable

View source: R/lagmatrix.R

lagmatrixR Documentation

Create lead/lags of a variable

Description

Create an array with lead/lags of an input variable.

Usage

lagmatrix(x, lag)

Arguments

x

input variable.

lag

vector of leads and lags. Positive numbers are lags, negative are leads. O is the original x.

Value

An array with the resulting leads and lags (columns).

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com

Examples

  x <- rnorm(10)
  lagmatrix(x,c(0,1,-1))


tsutils documentation built on Nov. 15, 2023, 1:08 a.m.