Name
lag — creation of a lagged matrix
CALLING SEQUENCE
[z]=lag(x,n,v)
PARAMETERS
- Input
x = input matrix or vector, (nobs x k)
n = (kx1) vector of lags
v = (optional) initial values (default=0)
- Output
z = matrix (or vector) of lags (nobs x k)
DESCRIPTION
Creates a matrix or vector of lagged values
if n <= 0, z = [] is returned. While you may find this perverse, it is sometimes useful.
for ts use lagts (see chapter 3)
EXAMPLE
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. !