*
* ARELLANO.RPF
* Adapted from Wooldridge(2002), example 11.3
*
cal(panelobs=7,a) 1981
all 90//1987:1
open data cornwell.prn
data(org=columns,format=prn) 1//1981:1 90//1987:1 county year crmrte
*
* Transform to log first differences
*
set lcrmrte = log(crmrte)
diff lcrmrte / clcrmrte
*
* The regression equation is 1st difference of the log crime rate on its
* lag. First differencing eliminates the individual county effect, but
* almost certainly produces serially correlated residuals, and thus, OLS
* would give inconsistent estimates because of the lagged dependent
* variable. The first set of estimates does instrumental variables using
* the second and third lags of the log crime rate as instruments. (The
* first lag still has a correlation with the residual). This is just run
* over one observation per individual (the final one) to avoid having to
* correct the covariance matrix for serial correlation.
*
instruments constant lcrmrte{2 3}
set smpl = %period(t)==1987:1
linreg(instruments,smpl=smpl) clcrmrte
# constant clcrmrte{1}
*
* Check 1st stage regression
*
set cllag = clcrmrte{1}
linreg(smpl=smpl) cllag
# constant lcrmrte{2 3}
*
* The lags tend to be rather weak instruments, and using a standard
* instrument setup will severely restrict the number of data points or
* instruments which could be used.
*
* A different approach is to create a separate instrument for each lag
* and for each time period and use GMM to weight them. This is the
* Arellano-Bond estimator. The instruments need to be constructed. This
* shows do to this, however, you could more simply use the procedure
* ABLags
*
* @ABLags lcrmrte abivs
*
compute m=7
dec vect[series] abivs((m-2)*(m-1)/2)
compute fill=1
do period=m,3,-1
do lag=period-1,2,-1
set abivs(fill) = %if(%period(t)==period,lcrmrte{lag},0.0)
compute fill=fill+1
end do lag
end do period
*
* The overidentification test is included in the regression output.
*
instrument constant abivs
linreg(title="Arellano-Bond",$
instruments,optimalweights,lwindow=panel) clcrmrte
# constant clcrmrte{1}