*@M_TAR_TREND series start end resids * * Computes the Momentum-TAR unit root test. References: * Enders, W. and Granger C.W.J (1998), "Unit-root Tests and Asymmetric Adjustment with an Example Using * the Term Structure of Interest Rates", Journal of Business and Economic Statistics, 16, 304-311 * Enders, W.(2001) "Improved critical values for the Enders-Granger unit-root test", Applied Economic * Letters, 8, 257-261 * * Options: * Model=[MTAR]/TAR; This determines whether the Threshold Autoregressive or Momentum-TAR unit root * test is computed * LAGS=number of additional lags [0] ; LAGS indicates the degree of AR polynomial on the differences * to include in the regressions * Method=[CONSISTENT]/KNOWN; These determine whether a consistent estimate as of Chan's method (1993) * or the sample mean are used for estimation of the threshold. * * The procedure offers the possibility of saving the residuals for diagnostic checking. * * * March 2007, Written by: Walter Enders and Razvan Pascalau, University of Alabama * rpascala@cba.ua.edu * Note: This procedure sets the linear attractor as a liner trend (and not as a level). * procedure M_TAR_TREND series1 start end resids type series series1 *resids type integer start end * option choice model 1 MTAR TAR option choice method 1 consistent known option integer lags 0 option switch print 1 * local series y yy dy dyy resids local integer v1 v2 nobs local rectangular[real] known consistent knownt consistentt * inquire(series=series1) v1>>start v2>>end * DIMENSION Known(3,13) Consistent(3,13) Knownt(3,4) Consistentt(3,13) * critical values at 90%, 95%, 97.5%, 99% (table 1 & 2 p. 259) compute Known = || 50 , 5.92 , 7.08 , 8.23 , 9.73 $ | 100 , 5.74 , 6.81 , 7.86 , 9.18 $ | 250 , 5.64 , 6.64 , 7.63 , 8.80 $ || compute Consistent = || 50 , 3.35 , 4.19 , 5.05 , 6.21 $ | 100 , 3.25 , 4.05 , 4.82 , 5.81 $ | 250 , 3.24 , 4.00 , 4.72 , 5.67 $ || compute Knownt = || 50 , 5.39 , 6.52 , 7.60 , 9.04 $ | 100 , 5.29 , 6.31 , 7.31 , 8.62 $ | 250 , 5.20 , 6.16 , 7.10 , 8.26 $ || compute Consistentt = || 50 , 4.84 , 6.18 , 7.69 , 9.90 $ | 100 , 4.52 , 5.60 , 6.74 , 8.48 $ | 250 , 4.37 , 5.30 , 6.26 , 7.54 $ || set time = t * if model.eq.2 { * if method.eq.2 { linreg(noprint,entries=2) series1 v1 v2 y ; # constant time ; *detrend the series if print { dis 'Intercept =' %beta(1) 'Slope =' %beta(2) } set flag = %if(y{1}<0,0,1) set yplus = flag*y{1} set yminus = (1-flag)*y{1} * dif y v1+1 v2 dy if lags { linreg dy v1+lags+1 v2 resids ; # yplus yminus dy{1 to lags} } else { linreg dy v1+1 v2 resids ; # yplus yminus } if print { display display 'TAR Unit Root Test, Series' %l(series1) display 'Regression Run From' %datelabel(v1+lags+1) 'to' %datelabel(v2) * exclude # yplus yminus display '---------------------------------------------------------' display ' With known threshold ' display '---------------------------------------------------------' compute f = %cdstat compute nobs = %nobs + 1 display 'critical values at' @20 '90%' @28 '95%' @36 '97.5%' @44 '99%' if nobs<100 display @3 'for 50 obs.' @19 #.## knownt(1,2) @27 #.## knownt(1,3) @36 #.## knownt(1,4) $ @43 #.## knownt(1,5) if nobs>100.and.nobs<250 display @3 'for 100 obs.' @19 #.## knownt(2,2) @27 #.## knownt(2,3) @36 #.## knownt(2,4) $ @43 #.## knownt(2,5) if nobs>250 display @3 'for 250 obs.' @19 #.## knownt(3,2) @27 #.## knownt(3,3) @36 #.## knownt(3,4) $ @43 #.## knownt(3,5) * now test rho1 = rho2 display '-----------------------------------------------------------------------' display 'Perform the test for symmetric adjustment(rho1=rho2)' restrict 1 # 1 2 # 1 -1 0 } } else if method.eq.1 { compute rss_test = 1000000.0 * dif series1 v1+1 v2 dseries1 set thresh_test1 = dseries1 order thresh_test1 compute low = v1 + 1 + fix(%nobs*.15), high = v2 - fix(%nobs*0.15) * compute thresh1 = thresh_test1(low) do ii = low,high set yy = dseries1 - thresh_test1(ii) dif yy v1+2 v2 dyy set flag = %if(yy{1}<0,0,1) set y_plus = flag*yy{1} set y_minus = (1-flag)*yy{1} linreg(noprint) dyy v1+2 v2 # y_plus y_minus if %rss < rss_test { compute rss_test = %rss compute thresh1 = thresh_test1(ii) } end do ii * compute rss_test2 = 1000000.0 set thresh_test0 = series1 - thresh1*t order thresh_test0 * compute thresh0 = thresh_test0(low) do ii = low,high set yyy = series1 - thresh_test0(ii) dif yyy v1+2 v2 dyyy set flag = %if(yyy{1}<0,0,1) set yy_plus = flag*yyy{1} set yy_minus = (1-flag)*yyy{1} linreg(noprint) dyyy v1+2 v2 # yy_plus yy_minus if %rss < rss_test2 { compute rss_test2 = %rss compute thresh0 = thresh_test0(ii) } end do ii if print { dis 'Intercept =' thresh0 'Slope =' thresh1 } * set yy = series1 - thresh0 - thresh1*t set flag = %if(yy{1}<0,0,1) set y_plus = flag*yy{1} set y_minus = (1-flag)*yy{1} * dif yy v1+1 v2 dyy if lags { linreg dyy v1+lags+1 v2 resids ; # y_plus y_minus dyy{1 to lags} } else { linreg dyy v1+1 v2 resids ; # y_plus y_minus } if print { display display 'TAR Unit Root Test, Series' %l(series1) display 'Regression Run From' %datelabel(v1+lags+1) 'to' %datelabel(v2) exclude # y_plus y_minus display '---------------------------------------------------------' display ' With consistent threshold ' display '---------------------------------------------------------' compute f = %cdstat compute nobs = %nobs + 1 display 'critical values at' @20 '90%' @28 '95%' @36 '97.5%' @44 '99%' if nobs<100 display @3 'for 50 obs.' @19 #.## consistentt(1,2) @27 #.## consistentt(1,3) @36 #.## consistentt(1,4) $ @43 #.## consistentt(1,5) if nobs>100.and.nobs<250 display @3 'for 100 obs.' @19 #.## consistentt(2,2) @27 #.## consistentt(2,3) @36 #.## consistentt(2,4) $ @43 #.## consistentt(2,5) if nobs>250 display @3 'for 250 obs.' @19 #.## consistentt(3,2) @27 #.## consistentt(3,3) @36 #.## consistentt(3,4) $ @43 #.## consistentt(3,5) * now test rho1 = rho2 display '-----------------------------------------------------------------------' display 'Perform the test for symmetric adjustment(rho1=rho2)' restrict 1 # 1 2 # 1 -1 0 } } } else if model.eq.1 { if method.eq.2 { linreg(noprint,entries=2) series1 v1 v2 y ; # constant time ; *detrend the series if print { dis 'Intercept =' %beta(1) 'Slope =' %beta(2) } dif y v1+1 v2 dy set flag = %if(dy{1}<0,0,1) set yplus = flag*y{1} set yminus = (1-flag)*y{1} * if lags { linreg dy v1+lags+1 v2 resids ; # yplus yminus dy{1 to lags} } else { linreg dy v1+1 v2 resids ; # yplus yminus } if print { display display 'M-TAR Unit Root Test, Series' %l(series1) display 'Regression Run From' %datelabel(v1+lags+1) 'to' %datelabel(v2) * exclude # yplus yminus display '---------------------------------------------------------' display ' With known threshold ' display '---------------------------------------------------------' compute f = %cdstat compute nobs = %nobs + 1 display 'critical values at' @20 '90%' @28 '95%' @36 '97.5%' @44 '99%' if nobs<100 display @3 'for 50 obs.' @19 #.## known(1,2) @27 #.## known(1,3) @36 #.## known(1,4) $ @43 #.## known(1,5) if nobs>100.and.nobs<250 display @3 'for 100 obs.' @19 #.## known(2,2) @27 #.## known(2,3) @36 #.## known(2,4) $ @43 #.## known(2,5) if nobs>250 display @3 'for 250 obs.' @19 #.## known(3,2) @27 #.## known(3,3) @36 #.## known(3,4) $ @43 #.## known(3,5) * now test rho1 = rho2 display '-----------------------------------------------------------------------' disply 'Perform the test for symmetric adjustment(rho1=rho2)' restrict 1 # 1 2 # 1 -1 0 } } else if method.eq.1 { compute rss_test = 1000000.0 * dif series1 v1+1 v2 dseries1 set thresh_test1 = dseries1 order thresh_test1 compute low = v1 + 1 + fix(%nobs*.15), high = v2 - fix(%nobs*0.15) * compute thresh1 = thresh_test1(low) do ii = low,high set yy = dseries1 - thresh_test1(ii) dif yy v1+2 v2 dyy set flag = %if(dyy{1}<0,0,1) set y_plus = flag*yy{1} set y_minus = (1-flag)*yy{1} linreg(noprint) dyy v1+2 v2 # y_plus y_minus if %rss < rss_test { compute rss_test = %rss compute thresh1 = thresh_test1(ii) } end do ii * compute rss_test2 = 1000000.0 set thresh_test0 = series1 - thresh1*t order thresh_test0 * compute thresh0 = thresh_test0(low) do ii = low,high set yyy = series1 - thresh_test0(ii) dif yyy v1+2 v2 dyyy set flag = %if(dyyy{1}<0,0,1) set yy_plus = flag*yyy{1} set yy_minus = (1-flag)*yyy{1} linreg(noprint) dyyy v1+2 v2 # yy_plus yy_minus if %rss < rss_test2 { compute rss_test2 = %rss compute thresh0 = thresh_test0(ii) } end do ii if print { dis 'Intercept =' thresh0 'Slope =' thresh1 } * set yy = series1 - thresh0 - thresh1*t dif yy v1+1 v2 dyy set flag = %if(dyy{1}<0,0,1) set y_plus = flag*yy{1} set y_minus = (1-flag)*yy{1} * if lags { linreg dyy v1+lags+1 v2 resids ; # y_plus y_minus dyy{1 to lags} } else { linreg dyy v1+1 v2 resids ; # y_plus y_minus } if print { display display 'M-TAR Unit Root Test, Series' %l(series1) display 'Regression Run From' %datelabel(v1+lags+1) 'to' %datelabel(v2) exclude # y_plus y_minus display '---------------------------------------------------------' display ' With consistent threshold ' display '---------------------------------------------------------' compute f = %cdstat compute nobs = %nobs + 1 display 'critical values at' @20 '90%' @28 '95%' @36 '97.5%' @44 '99%' if nobs<100 display @3 'for 50 obs.' @19 #.## consistent(1,2) @27 #.## consistent(1,3) @36 #.## consistent(1,4) $ @43 #.## consistent(1,5) if nobs>100.and.nobs<250 display @3 'for 100 obs.' @19 #.## consistent(2,2) @27 #.## consistent(2,3) @36 #.## consistent(2,4) $ @43 #.## consistent(2,5) if nobs>250 display @3 'for 250 obs.' @19 #.## consistent(3,2) @27 #.## consistent(3,3) @36 #.## consistent(3,4) $ @43 #.## consistent(3,5) * now test rho1 = rho2 display '-----------------------------------------------------------------------' disply 'Perform the test for symmetric adjustment(rho1=rho2)' restrict 1 # 1 2 # 1 -1 0 } } } end