Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: panel
See also: panstats pantimes

Quantlet: panlag
Description: computes the lag of the variable

Usage: y = panlag(z,a{, T})
Input:
z NT x {2+}k matrix of panel data
a scalar, parameter used to compute y(i,t)=(1-a)*z(i,t)+a*z(i,t-1). if a = 0, no lag but truncation of the first observation if a = 1, lag with truncation of the last observation
T optional scalar, number of time periods for a BALANCED data set. Used for a data set with the same T for all individuals = BALANCED PANEL
Output:
y output matrix with lagged (truncated) observations. For unbalanced data: The first two columns are the adapted indices for the individuals and time periods.

Example:
library("panel")
z=read("dynpanel.dat")   ; read data set
it=z[,1:2]               ; matrix of indices
z0=panlag(it~z[,4],0)    ; truncate first observation
z1=panlag(it~z[,4],1)    ; lag of second variable
itlag=z0[,1:2]           ; new indices
dz2=z0[,3]-z1[,3]        ; differences of the second var.
itlag~dz2

Result:
Remark: to save space, only the first 16 elements of itlag
and dz2 are shown here.

Contents of _tmp
[  1,]        1        2   1.2226
[  2,]        1        3  0.22922
[  3,]        1        4 -0.29302
[  4,]        1        5  -1.1603
[  5,]        1        6 -0.53256
[  6,]        1        7  0.34027
[  7,]        1        8   -1.296
[  8,]        1        9  0.45796
[  9,]        1       10    1.868
[ 10,]        1       11   -1.763
[ 11,]        1       12  0.66435
[ 12,]        1       13  -1.1309
[ 13,]        1       14 -0.87567
[ 14,]        1       15 -0.39465
[ 15,]        2        2   -2.634
[ 16,]        2        3  0.78664



Author: J. Breitung, 20011012 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006