powered by
Create matrix with lead/lags of an input vector.
lagmatrix(x, lag)
Input variable.
Vector of leads and lags. Positive numbers are lags, negative are leads. O is the original x.
lmat - Resulting matrix.
lmat
# NOT RUN { x <- rnorm(10) lagmatrix(x,c(0,1,-1)) # }
Run the code above in your browser using DataLab