* SHAZAM procedure for stationarity tests * * REFERENCES: * S.J. Leybourne and B.P.M. McCabe, "Modified Stationarity Tests with * a Data Dependent Model Selection Rule", discussion paper, Mar. 1996. * This is an extension to: * S.J. Leybourne and B.P.M. McCabe, "A Consistent Test for a Unit Root", * Journal of Business and Economic Statistics, Vol. 12, 1994, pp. 157-166. * * WARNING: * The test statistic requires ARIMA model estimation. * Different computer packages implement different optimisation methods * and this may result in some numerical differences in the computation * of test statistics. * * HOW TO USE THE PROCEDURE: * Input variables must be defined as follows: * VAR: the time series * P: the order of the AR component * * To use the procedure type the commands: * FILE PROC STEST * EXEC STEST * * OUTPUT FROM THE PROCEDURE * The output printed from the STEST procedure is as follows: * NOBS_ number of observations * AR_ the order of the AR component * THETA_ the estimate of the moving average parameter * Z_ Z-statistic * Q6_ the Box-Pierce Q(6) statistic * CHI6_ the Ljung-Box-Pierce Q(6) statistic * STILDE_ the s-tilde statistic * * ====================================================================== * Programmed by Diana Whistler Revision Date: Jun 3, 1996 * E-mail: diana@shazam.econ.ubc.ca * ====================================================================== * SET NODOECHO NOECHO PROC STEST SET NOOUTPUT NOWARN NODOECHO NOECHO GEN1 NOBS_=\$N COPY [VAR] Y_ / TROW=1,NOBS_ * ===> Estimate an ARIMA(p,1,1) model GEN1 AR_=[P] * Set starting values GEN1 KK_=AR_+2 DIM INIT_ KK_ * The AR parameters IF1(AR_.GE..01) SAMPLE 1 AR_ IF1(AR_.GE..01) GENR INIT_=.1 * The constant SAMPLE KK_ KK_ GENR INIT_=.01 * The MA parameter GEN1 KK_=AR_+1 SAMPLE KK_ KK_ GENR INIT_=.5 * ARIMA estimation SAMPLE 1 NOBS_ ARIMA Y_ / DN NAR=AR_ NMA=1 NDIFF=1 START=INIT_ COEF=BETA_ & ACF=ACF_ TESTSTAT=CHI_ * The estimate of the noise variance GEN1 SIGML_=\$SIG2 GEN1 KK_=\$K-1 IF1(\$ERR.NE.0) STOP * The MA(1) parameter GEN1 THETA_=BETA_(KK_) GEN1 SIGEPS_=SIGML_*THETA_ * Compute the Z-statistic GEN1 Z_=0 IF1(AR_.GE..01) GEN1 Z_=SQRT(NOBS_-1)*BETA_(AR_)*THETA_ * The Ljung-Box-Pierce Q(6) test statistic GEN1 CHI6_=CHI_:6 * The Box-Pierce Q(6) test statistic SAMPLE 1 6 GENR ACF2_=ACF_*ACF_ STAT ACF2_ / SUMS=Q6_ GEN1 Q6_=(NOBS_-1)*Q6_ * ===> Calculate the filtered observations SAMPLE 1 NOBS_ GENR YSTAR_=Y_ DO #=1,AR_ ENDIF(AR_.LE..01) GENR YSTAR_=YSTAR_-BETA_(#)*LAG(Y_,#) ENDO * ===> Get OLS residuals GENR TIME_=TIME(0) GEN1 BEG_=AR_+1 SAMPLE BEG_ NOBS_ OLS YSTAR_ TIME_ / RESID=E_ GEN1 NOBS2_=\$N * Cumulative sum of the residuals starting at obs 1 GENR CSUM_=SUM(E_) * ===> Compute the stationarity test statistic S MATRIX STILDE_=(CSUM_'CSUM_)/(NOBS2_*NOBS2_*SIGEPS_) PRINT NOBS_ AR_ THETA_ Z_ Q6_ CHI6_ STILDE_ DELETE / ALL_ SET OUTPUT WARN DOECHO ECHO PROCEND