41.0 MVNLTEST Command
The MVNLTEST command contains various experimental non-linearity
tests developed by Melvin J. Hinich for two series to determine if
there is a nonlinear relationship. The tests are the third order
extension to cross correlation analysis. If tests on a single series are
desired, the BISPEC, POLYSPEC and TRISPEC sentences should be used.
These three sentences are documented under and BTIDEN paragraph (see
section 20) and are callable under the RR paragraph (section 11), the
BJIDEN paragraph (section 18), the BJEST paragraph (section 19), the
BTIDEN paragraph (section 20), the BTEST paragraph (section 21), the
MARS paragraph (section 33) and the PISPLINE paragraph section 34).
It is stressed that these procedures are in "test form" and are in
no way production code. In addition there is no long run commitment
to keep these procedures in the B34S. They are provided in 'AS IS'
form.
If users wish to test residuals from the above models, the
appropriate procedure is to make a SCA FSAVE file and load this saved
file into B34S using the SCAINPUT paragraph (see section 31).
References:
Melvin J. Hinich "Testing for Dependence in the Input to a Linear Time
Series Model." Journal of Nonparametric Statistics 6, 1996, 205-221
Chris Brooks and Melvin J. Hinich "Cross-Correlations and Cross-
Bicorrelations in Sterling Exchange Rates." memo 1997
Chris Brooks, Melvin J. Hinich and Robert Molyneux. "Episodic Nonlinear
Event Detection: Political Epochs in Exchange Rates." memo 1997
Form of MVNLTEST command.
B34SEXEC MVNLTEST options paramaters$
VAR var1 var2$
CBIS options parameters$
THIRDORDER options paramaters$
B34SEEND$
The MVNLTEST command must have either the THIRDORDER sentence or the
CBIS sentence or both. The VAR sentence must be supplied.
MVNLTEST sentence options and parameters.
IBEGIN=n1 Sets beginning observation. Defaults to 1.
IEND=n2 Sets ending observation. Defaults to NOOB.
SCAUNIT=n3 Sets SCA FSAVE file unit. Default = 44. If
any use of this file is made, it must be opened
with the B34S OPTIONS command. The below listed
code shows how this is done.
B34SEXEC OPTIONS OPEN('MY.FSV') UNIT=44
DISP=UNKNOWN$ B34SRUN$
B34SEXEC OPTIONS CLEAN(44)$ B34SRUN$
SCAFNAME1=' ' Sets SCA FSAVE file name for saving spectrum
using SAVESPEC under CBIS command. Default =
'SPEC'.
SCAFNAME2=' ' Sets SCA FSAVE file name for saving
cross bispectrum using SAVECBIS under CBIS
command. Default = 'CBIS'.
SCAFNAME3=' ' Sets SCA FSAVE file name for saving
second and third order tests using
SAVESTAT command under THIRDORDER sentence.
Default = 'THIRDO'.
VAR Sentence
The VAR sentence supplies the names of the two series and is
required.
VAR(sname1, sname2) Supplies series to be studied. Only two series
can be supplied.
CBIS Sentence
The CBIS sentence controls calculation of the Cross Bispectrum
and spectrum of two series. These tests provide information about
nonlinear relationships between the two series. An indication of such a
relationship would be if the Gain of the Cross bispectrum was > 1.
CBIS sentence options and parameters.
SAVESPEC Saves spectrum in SCA FSAVE file having name
SCAFNAME1.
PRINTSPEC Prints spectrum.
SAVECBIS Saves cross bispectrum in SCA FSAVE file having
name SCAFNAME2.
PRINTCBIS Prints significant cross bispectrum values.
FREQ Gives frequency values.
PERIOD Gives period values. This is the default
NOSPROD Divides by the variance. This option can be
used if x and y series have no autocorrelation.
The default is to divide by the spectral
products.
FREQSAMPU Set if the sampling unit is frequency. The
default is time.
SMOOTH Set if smoothing is desired. The bandwidth
for smoothing can be set with NWD or SSBAND.
If SMOOTH is set but NWD or SSBAND are not
set, defaults will be used.
SAMPLERATE=r1 If FREQSAMPLU is in effect, SAMPLERATE is a
multiple of KHz (1000 Hz).
If FREQSAMPLU is not in effect, SAMPLERATE is
a multiple of milsec (1/Khz). Default = 1.
RESBAND=r2 Sets resolution bandwidth in Hz. Default = 5.
CLIP=r3 Sets the data clip value that will transform
all series prior to running tests to reduce
kurtosis. This transformation reduces bias in
the Hinich tests but reduces their power.
Assume clip = 2.0. This means that
(x(t)-mean(x)) + (2.0 * sd) and
(x(t)-mean(x)) - (2.0 * sd) are upper and lower
bounds on the data. If clip is set =2.0, then
the 2% is clipped from the extreams of the
data.
SSBAND=r4 Sets spectral smoothing bandwidth in Hz. The
smoothing window NWD is related to this
value by the FORTRAN formula
NWD=2*IDNINT(SSBAND*DFLOAT(N)/2.0d+00) + 1
If SSBAND is supplied it overrides NWD
NWD=n1 Sets width for smoothing cosin. Default =
3*dqsrt(N).
FL=r5 Lower frequency for analysis. Default = 0.
FL must never be set LT 0.0.
FU=r6 Upper frequency for analysis. Default = .475
which is the upper limit.
PERCENTT=r5 Sets percent taper. Default = 0.0.
The below listed example tests x and y using default settings.
b34sexec mvnltest$
var(gasin,gasout)$
cbis printcbis$ b34seend$
THIRDORDER Sentence
The THIRDORDER sentence controls the calculation of second and
third order portmentau test statistics for two series. Such measures can
be used to detect the presence of a nonlinear relationship between the
series. The test results are affected by autocorrelation in the series.
THIRDORDER sentence options and parameters.
SAVESTAT Saves second and third order tests statistics
in SCA FSAVE file having SCAFNAME3.
LISTMSTAT List moving statistics.
PLOTACF Plots ACF and PACF.
NAC=n1 Sets number of autocorrelations to calculate on
windows. Default is MIN0(NWIN/2,150) where NWIN
is the number of observations in the window.
NPAC=n2 Sets number of partial autocorrelations to
calculate.
NAPL=n3 Sets number of acf's to print per line. Default
=12.
C=r1 Sets number of lags to use. Default = .4. The
number of lags = NOB**C. C must not be set >
.5.
WINDOW=n1 Sets window. Default = 0 implies that complete
sample is used.
POVERL=r2 Sets percent overlap. Default = 0. POVERL must
be set in the range 0 LE POVERL LE .99 .
Variables saved and or printed include uniform deviate portmentau
tests measuring:
- HX Probability of nonlinearity in x. = chisq(xxx) df = nbc
- HY Probability of nonlinearity in y. = chisq(yyy) df = nbc
- HXY Probability of nonlinearity from x to y. = chisq(xxy) df = nbcr
- HYX Probability of nonlinearity from y to x. = chisq(yyx) df = nbcr
- PX Autocorrelation in x. = chisq(xx) df = lg
- PY Autocorrelation in y. = chisq(yy) df = lg
- PXY Cross correlation between x and y. = chisq(xy) df = n2c
Note: lg = NOOB **c
nbc = (lg-1)*lg/2
nbcr= # number of bicorrelations
n2c = (2*lg) + 1
The below listed example calculates nonlinearity tests for gasin and
gasout for the complete period. The data should been run from the
residuals of a VAR model of GASIN and GASOUT to remove all
autocorrelation in the series being analysed.
b34sexec mvnltest$
var gasin gasout$
thirdorder$ b34seend$
The next example tests x and y and uses 50% overlapping windows of
size 500. Statistics are saved in a file.
b34sexec options open('myrun.fsv') unit(44) disp=unknown$
b34seend$
b34sexec options clean(44)$ b34seend$
b34sexec mvnltest $
var x y$
thirdorder poverl=.5 window=500 savestat$
b34seend$
Further examples:
/;
/; Tests Hinich 1996 using "Detecting anbd Modeling Nonliuenarity in the
/; Gas Furnace Data
/;
b34sexec options ginclude('gas.b34'); b34srun;
/; Variables saved and or printed include uniform deviate portmentau
/; tests measuring:
/; - HX Probability of nonlinearity in x. chisq(xxx)
/; df = nbc
/; - HY Probability of nonlinearity in y. chisq(yyy)
/; df = nbc
/; - HXY Probability of nonlinearity from x to y. chisq(xxy)
/; df = nbcr
/; - HYX Probability of nonlinearity from y to x. chisq(yyx)
/; df = nbcr
/; - PX Autocorrelation in x. chisq(xx)
/; df = lg
/; - PY Autocorrelation in y. chisq(yy)
/; df = lg
/; - PXY Cross correlation between x and y. chisq(xy)
/; df = n2c
/;
/;
/; Note: lg = NOOB **c
/; nbc = (lg-1)*lg/2
/; nbcr= # number of bicorrelations
/; n2c = (2*lg) + 1
/;
/;
b34sexec matrix;
call loaddata;
call olsq(gasin gasout{1 to 6} gasin{1 to 6} :print);
res1=%res;
call olsq(gasout gasout{1 to 6} gasin{1 to 6} :print);
res2=%res;
call makedata(res1 res2 :file '_res.b34');
b34srun;
b34sexec options include('_res.b34'); b34srun;
b34sexec mvnltest $
var res1 res2$
thirdorder poverl=.0 window=20 listmstat$
b34srun$
b34sexec mvnltest $
var res1 res2$
thirdorder poverl=.0 window=30 listmstat$
b34srun$
/; Hinich Cross Bispectrum
/;
/; Makes a great deal of output!!
/;
b34sexec options ginclude('gas.b34'); b34srun;
b34sexec mvnltest$
var(gasin,gasout)$
cbis printcbis$ b34seend$