powered by
Generates a matrix of a given vector and its 1 to k-period lags. Missing values due to lag are filled with NAs.
lagk(u, lag = 1, delete = TRUE)
Matrix of vector u and its 1 to k-period lags.
u
a vector of one variable, usually residuals.
the number of periods up to which lags should be generated.
logical value indicating whether missing data should be eliminated from the resulting matrix.
u = round(rnorm(10),2) lagk(u) lagk(u,lag = 3) lagk(u,lag = 3, delete = FALSE)
Run the code above in your browser using DataLab