Name

tdiff — produce matrix differences

CALLING SEQUENCE

[dmat]=tdiff(x,k)

PARAMETERS

Input

• x = input matrix (or vector) of length nobs

• k = lagged difference order

Output

• dmat = matrix or vector, differenciated by k-periods, e.g. x(t) - x(t-k), of length nobs, (first k observations are zero)

DESCRIPTION

Produces matrix differences.

EXAMPLE


1) x1=ones(7,1);x2=[1:7]';y = tdiff([x1 x2],2)

2) dep = tdiff(r,1);

 

Example 1 gives the matrix: 

!   0.    0. !

!   0.    0. !

!   0.    2. !

!   0.    2. !

!   0.    2. !

!   0.    2. !

!   0.    2. !

In example 2, taken from cadf, vector r is differenciated once.



               

AUTHOR

Eric Dubois 2002