Menu ▾ ▴

#341 Panel Durbin-Watson ($dw) leaves out the last unit's last squared difference.

v1.0_(example)
closed-fixed
nobody
None
5
4 days ago
5 days ago
No

gretl 2026d, Windows 11 Pro 64-bit.

Ticket [#194] says the panel Durbin–Watson statistic follows Bhargava, Franzini & Narendranathan (1982, Review of Economic Studies 49, eq. (4), p. 535):

d_p = Σ_i Σ_{t=2..T} (e_it − e_i,t−1)² / Σ_i Σ_t e_it²

On a balanced panel, the statistic that gretl prints and returns in $dw is d_p without its last term. That term is the squared difference between the last two residuals of the last unit. This holds after panel ... --fixed-effects and after ols on panel data. The time-series statistic is right.

The attached panel-dw-last-term.inp uses grunfeld. The core of it:

open grunfeld
panel invest const value kstock --fixed-effects --quiet
series e = $uhat
series de = diff(e)
printf "%.10f %.10f %.10f\n", $dw, sum(de^2)/sum(e^2), (sum(de^2) - de[$nobs]^2)/sum(e^2)

Results:

                                $dw            d_p            d_p without the last term
FE, 10 x 20                     0.6844745614   0.6844796875   0.6844745614
pooled OLS, 10 x 20             0.2097159803   0.2097170940   0.2097159803
FE, firms 1-3, 1935-1938        1.7063836252   1.7438656591   1.7063836252
time series, firm 1 alone       0.9374539053   0.9374539053

The gap is small on long panels but 0.037 on the short one. $dwpval is computed from the reported $dw (0.601873 on the short panel), so it is affected too. It looks like a loop bound that stops one difference early in the panel branch.

An independent check: Stata reports the same statistic after xtregar, lbi as the "modified Bhargava et al. Durbin–Watson" (d1 under Methods and formulas in the xtregar entry of Stata's Longitudinal-Data/Panel-Data Reference Manual). Its formula, applied to gretl's grunfeld with 1943 and 1944 left out, gives 0.70578894 and the Baltagi–Wu LBI 1.0218978, where the manual's example 3 prints .70578896 and 1.0218978. On the full panel the same formula gives 0.6844796875, not 0.6844745614.

1 Attachments

Related

Bugs: #194

Discussion

  • Allin Cottrell

    Allin Cottrell - 4 days ago
    • status: open --> closed-fixed
     
  • Allin Cottrell

    Allin Cottrell - 4 days ago

    Thanks for the report, Kirill. This point is now fixed in gretl git.

     

Log in to post a comment.