Library: | metrics |
See also: | panstats pantimes |
Quantlet: | panlag | |
Description: | Computes the lag of the variable |
Usage: | {zlag}=panlag(z,a, {T}) | |
Input: | ||
z | NT x {2+} + k Matrix | |
T | Number of time periods for a BALANCED Dataset. Optional, only for a Dataset with the same T for all Individuals = BALANCED PANEL | |
a | parameter used to compute y(i,t)=(1-a)*z(i,t)+a*z(i,t-1). a=0: No lag but truncation of the first observation a=1; Lag with truncation of the last observation | |
Output: | ||
zlag | output matrix with lagged (truncated) observations. For unbalanced data: First two columns are the adapted indices for the individuals and time periods. |
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
[ 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
Library: | metrics |
See also: | panstats pantimes |