*
* @HinichTest(options) x start end
*
* Performs the Hinich bispectrum test for linearity and Gaussianity
* as described in Hinich and Patterson (1989), "Evidence of
* nonlinearity in the trade-by-trade stock market return generating
* process", in Economic Complexity: Chaos, Sunspots, Bubbles and
* Nonlinearity, Barnett, Geweke and Shell, eds. Cambridge
* University Press.
*
* Note that this requires quite a bit of memory if you get above a
* few thousand data points.
*
* Parameters:
* x series to test
* start end range to use (by default, the defined range of <>)
*
* Options:
* FRAME=separation of lattice points [square root of number of data points]
* The input or computed value is rounded up to an odd number.
* QUANTILE=quantile of the empirical distribution examined in the linearity
* test [.8]
*
* Revision Schedule:
* 05/2005 Written by Tom Doan, Estima
* 04/2006 QUANTILE option added
* 02/2018 Add check for negative non-centrality on linearity test.
*
procedure HinichTest x start end
type series x
type integer start end
*
option integer frame
option real quantile .8
*
local integer endl startl
local integer n m p j
local integer s1 s2 s3 r1 r2 w1 w2 base half fill
local real scalebi scaleuni uni1 uni2 uni12 ssqr
local rect[complex] bispect
local vector unispect skewsq
local complex bispects
local real xihat lambda0 mean var lstat
*
* Get the sample range, and Fourier transform the data
*
inquire(series=x) startl<