creation of a lagged matrix
[z]=lag(x,n,v)
* x = input matrix or vector, (nobs x k)
* n = (kx1) vector of lags
* v = (optional) initial values (default = 0)
* z = matrix (or vector) of lags (nobs x k)
y = lag([1:8]',2) // returns : //! 0. ! //! 0. ! //! 1. ! //! 2. ! //! 3. ! //! 4. ! //! 5. ! //! 6. ! x1=ones(7,1);x2=[1:7]';y = lag([x1 x2],1,4) // returns //! 4. 4. ! //! 1. 1. ! //! 1. 2. ! //! 1. 3. ! //! 1. 4. ! //! 1. 5. ! //! 1. 6. ! | ![]() | ![]() |