On Sun, 14 Jul 2019, Artur Tarassow wrote:
Am 13.07.19 um 23:12 schrieb Allin Cottrell:
>
> That's now done in git. "modtest --autocorr" (or the
> "Autocorrelation" menu item under Tests in the model window)
> gives the Wooldridge test, provided the estimator is fixed or
> random effects and the panel has a time-series length of at least
> 3.
>
Hi Allin, thanks for implementing this test. I've realized that
your results differ from the package's one. I think the reasons
are:
1) The wooldridge_test_serial() function does currently not work
correctly in case an intercept is passed as an regressor as it is
automatically omitted due to the "diff" command -- this is not
correctly controlled in the package. You can try this and check
the print-out:
<hansl>
open abdata.gdt
list X = const n k
matrix M = wooldridge_test_serial(ys,X)
print M
</hansl>
Yes, I noticed that. The built-in version preserves the constant in
the regression list. More on this point below.
2) I've corrected issue (1) such that the point estimates of the
"First-Differenced equation" and the auxiliary regression on the
residuals are equal to the one gretl produces. However, the
standard errors are different -- I don't know why.
Ah, I was using the internal lsq() function for the auxiliary
regressions, and the robust option invoked a White-style HCCME, not
the panel-clustered variant. I've now amended the built-in code so
that it gives clustered standard errors.
3) The degrees of freedom used for computing the test statistics
also differ. The wooldridge_test_serial() function, for instance,
applies the $df accessor which accesses the number of
cross-sectional units after the ols command given a panel data
set.
That's also to do with clustering or not. In the cluster-robust case
the df equals (-1 plus) the number of clusters (i.e. cross-sectional
units), not the number of observations. I didn't notice that because
I was working with the Wooldridge chapter 10 example, where T = 3
and the number of obs in the residual autoregression equals the
number of units. (With T > 3 this regression does not boil down to a
cross section and the two df variants diverge.)
Back to the issue of the constant. I notice that "xtserial"
(Wooldridge test for Stata) does not include a constant in the FD
equation. The FD specification includes a constant only if it
"appears" via differencing of a time trend, or is otherwise present
in the span of the differenced regressors.
Maybe that's right. In his chapter 10 example Wooldridge includes a
constant in his FD specification but that doesn't settle the matter:
his use of const and d89 is equivalent to omitting the constant but
including the differences of his d88 and d89 dummies (as xtserial
would).
Allin