@ @ ---- Flexible Fourier Stationarity Test ------------------------- @ @ ---- Based on the "kpss.txt" procedure of J. Lee ---------------- @ @ ---- Modified by R. Pascalau, University of Alabama, Oct 2006 --- @ closeall; format /m1/rd 10,3 ; output file = series.out reset; load data[T,1] = series.txt; /* load your series */ @ --- BIG-BIG Loop --- @ isw = 0; /* isw = 0 without trend , isw = 1 with trend */ do while isw < 2; if isw == 0; "";"";""; " ----- Test for Fourier drift stationarity ----"; else; "";"";""; " ----- Test for Fourier trend stationarity ----"; endif; clear y,x,e,beta,s,tt; y = data[1:T,1]; n = rows(y); tt = seqa(1,1,n); z = 2*pi*tt*1/n; fsin = sin(z); fcos = cos(z); if isw == 0; x = ones(n,1) ~ fsin ~ fcos; endif; if isw == 1; x = ones(n,1) ~ fsin ~ fcos ~ tt; endif; beta = inv(x'x)*x'y; e = y - x * beta ; s = cumsumc(e); top = s's / n^2 ; sum1 = e'e / n; lagloop=13; lag=0; do until lag == lagloop; lag1=lag+1; it=1; is=1; sum2=0; do while is