lagk: 1 to k-Period Lags of Given Vector

View source: R/lagk.R

lagkR Documentation

1 to k-Period Lags of Given Vector

Description

Generates a matrix of a given vector and its 1 to k-period lags. Missing values due to lag are filled with NAs.

Usage

lagk(u, lag = 1, delete = TRUE)

Arguments

u

a vector of one variable, usually residuals.

lag

the number of periods up to which lags should be generated.

delete

logical value indicating whether missing data should be eliminated from the resulting matrix.

Value

Matrix of vector u and its 1 to k-period lags.

Examples

u = round(rnorm(10),2)
lagk(u)
lagk(u,lag = 3)
lagk(u,lag = 3, delete = FALSE)


desk documentation built on May 29, 2024, 6:05 a.m.

Related to lagk in desk...