lagmat: lagmat

Description Usage Arguments Value Examples

Description

Creates a lagged matrix with the desired number of lags.

Usage

1
lagmat(x, lags)

Arguments

x

the series to be lagged

lags

number of lags desired

Value

matrix with dimension [NROW(x),length(lags)]

Examples

1
2
3
4
x = rnorm(100)
lx <- lagmat(x,2)
tail(lx)
tail(x)

Example output

             Lag1       Lag2
 [95,]  0.9889467  0.5625392
 [96,] -1.2681550  0.9889467
 [97,] -0.6646279 -1.2681550
 [98,]  0.2050860 -0.6646279
 [99,]  0.3825937  0.2050860
[100,]  0.1970339  0.3825937
[1] -1.2681550 -0.6646279  0.2050860  0.3825937  0.1970339  0.4525458

Eplot documentation built on May 2, 2019, 2:42 a.m.