(The regression is incorrect from econometric point of view,
just to give an easily reproducible example)
open /usr/local/share/gretl/data/misc/denmark.gdt
ols LRM const LRY
dw=$dwpval
(here Durbin-Watson = 0.298798)
From script output:
? dw=$dwpval
Imhof integral gave negative value
Error executing script: halting
> dw=$dwpval
May be it worth to include into the function
something like this: if dw<dw0 pvalue<e-N for some N?