*
* @EndersSiklos( options) u start end
* does various types of the unit root regressions with threshold breaks
* on the residuals from an Engle-Granger cointegrating regression
* (assumed to be done already---the input u are the residuals).
*
* The regression run is
*
* du = (rho1 D1 x u{1} + rho2 D2 x u{1}) + lags of du
*
* where D1 is the dummy for threshold series < tau and D2 is
* 1-D1.
*
* It produces three test statistics:
*
* t-max is the larger of the two t-statistics on rho1=0 and rho2=0.
* phi is the joint F-test for rho1=rho2=0
* equal is the test for rho1=rho2.
*
* Parameters:
* u = series of residuals from Engle-Granger regression
* start end = range to use [defined range of u]
*
* You can either input the threshold value or request a search.
*
* Options:
* LAGS=# of lags on the differences [1]
* THRESHOLD=series which determines the threshold (required!)
*
* TAU=threshold value [not used, chosen by search]
* PI=fraction of high and low empirical values for the threshold series
* which are omitted in the search.
*
* If you provide a value of TAU, the regressions are done with that
* fixed value for tau. If you don't, the values of the threshold series
* (excluding the PI fraction at each end) are searched for the one that
* minimizes the sum of squared residuals
*
* Variables Defined:
* %%BREAKVALUE Threshold value chosen or input
* %%EQUALSTAT F-test for rho1=rho2
* %%PHISTAT joint F-test for rho1=0 and rho2=0
* %%TMAX maximum t-statistic between rho1=0 and rho2=0
*
* Reference: Enders and Siklos(2001), "Cointegration and Threshold
* Adjustment," JBES, vol. 19, no. 2, 166-76.
*
* Revision Schedule:
* 05/2011 Written by Tom Doan, Estima
* 10/2014 Add check for THRESHOLD empty
*
procedure EndersSiklos u start end
type series u
type integer start end
*
option integer lags 1
option series threshold
option real tau
option real pi .15
option string title
*
local series du
local vec[series] xsplit
local integer i ttau
local vector testvalues
local integer startl endl pistart piend
local real rssbest ltau taubest
local report esreport
local string ltitle
*
if .not.%defined(threshold).or..not.%defined(u) {
disp "###Usage: @EndersSiklos(THRESHOLD=threshold series,other options) U ..."
return
}
*
set du = u-u{1}
*
inquire(reglist) startl<=ltau)
set xsplit(2) = u{1}*(threshold=ltau)
set xsplit(2) = u{1}*(threshold