Syntax: @lag(m,l)

Argument 1: matrix, m

Argument 2: integer, l

Return: matrix

Create a matrix of the same size as m, with rows shifted down (or up if l is negative) l places. Unavailable rows will be filled with NAs.

Example:

matrix(5,4) a

rnd(a)

matrix b = @lag(a,2)

Matrix a will be a 5x4 matrix containing random numbers. Matrix b will have two rows of NAs, followed by the first through third rows of a.