On Sun, 28 Feb 2021, Sven Schreiber wrote:
>> I guess it would be useful if we could include the popular
BDS test:
>> Brock, Dechert and Scheinkman (1987) (and later published as Brock,
>> Dechert, Scheinkman and LeBaron, 1996; apparently there is some C code
>> by LeBaron from 1997, LeBaron, B.(1997). “A Fast Algorithm for the BDS
>> Statistic”, Studies in Nonlinear Dynamics and Econometrics, 2, 53-59,
>> but maybe not necessary?) [...]
I can see this could be useful if you just have a residual series
you want to test (e.g. after ARMA). So I've put it into git on a
trial basis. There's a new C-plugin, bdstest, which supports (for
now) a "hidden" function, _bdstest(). It's based on LeBaron's
"fast"
code. The signature of the hidden function is:
matrix _bdstest(series x, int m, scalar eps)
where m is the embedding level (>= 2) and eps the cut-off for
"closeness". Right now eps is just a raw number in the units of x,
but if we pursue this it should probably be expressed as a fraction
of the standard deviation of x (a rule of thumb seems to be eps =
0.5*sd(x)).
The return value is a column vector of m-1 z-scores, for testing at
embedding levels 2 to m.
I'm attaching LeBaron's sample data as x.txt, and the output from
his original program as output.txt. You can replicate this via
<hansl>
open x.txt
matrix B = _bdstest(x, 5, 100)
print B
</hansl>
The plugin file bdstest.c can also be copied out of the source tree
and compiled as a stand-alone "libgretl program", by defining
STANDALONE to 1 near the top of the file. In that mode the program
does Monte Carlo, which reveals that the test over-rejects quite
substantially for series of typical econometric length -- so if we
pursue this we may want to look into MBDS. The MC parameters are
mostly hard-wired; edit the C to change things.
Allin