<< mlag0 Basic functions mvblockboot >>

Grocer >> Basic functions > mlagb

mlagb

lag a matrix

CALLING SEQUENCE

[xlag]=mlagb(x,n,init)

PARAMETERS

Input

* x = a matrix (or vector), nobs x nvar

* nlag = # of lags for each vector in x

* init = (optional) scalar value to feed initial missing values (default = 0)

 

Output

* xlag = a matrix of lags (nobs x nvar*nlag)

collected as: x(t-1),x(t-1) ... ,x(t-nlag)

DESCRIPTION

Generates a matrix of n lags from a matrix (or vector) containing a set of vectors (For use in var routines): rows are ordered by lags (and not by vectors as in mlag).

EXAMPLE

x1=ones(7,1);x2=[1:7]';y = mlagb([x1 x2],2,4)
// returns:
 
//!   4.    4.    4.    4. !
//!   1.    1.    4.    4. !
//!   1.    2.    1.    1. !
//!   1.    3.    1.    2. !
//!   1.    4.    1.    3. !
//!   1.    5.    1.    4. !
//!   1.    6.    1.    5. !
 
 
xlag = mlagb(y,nlag);
// Example taken from function var1: takes all lags from 1 to nlag of endogenous variables in the var to form the matrix of regressors.

AUTHOR

Eric Dubois 2002

Report an issue
<< mlag0 Basic functions mvblockboot >>