Stata time-series operator can be applied to panel data when both
panel and time identifier are set with the xtset command.
The model we estimates;
We use the data Paneldata01.
To regress Eq(1), first, sort
id and t and then regress;
xtset
id t
sort
id t
regress
lwage exp exp2 wks ed,vce(cluster id)
To compute first-order autocorrelations for
panel data for certain variable;
correlate
lwage L.lwage
To calculate autocorrelation at all lags (six periods) for the
residual Eq(1);
quietly
regress lwage exp exp2 wks ed,vce(cluster id)
predict
uhat,residuals
forvalues
j = 1/6 {
quietly corr uhat L `j’.uhat
display “Autocorrelation at lag `j’ =
“%6.3f r(rho)
}
Drukker (2003) provides simulation results showing that the test has good size and power properties in reasonably sized samples.
There is a user-written program, called xtserial, written by David Drukker to perform this test in Stata;
xtserial lwage exp exp2 wks ed, output
The null hypothesis for the test is there is no serial
correlation in the model.
The results show that the null hypothesis
of no serial correlation is strongly rejected, means that there is serial correlation in the model.
No comments:
Post a Comment