@ @ ---- Computes the best frequency for the ------------------------ @ @ ---- 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 = freq.out reset; load data[89,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; "";"";""; " ----- Best frequency for Fourier drift stationarity ----"; else; "";"";""; " ----- Best frequency for Fourier trend stationarity ----"; endif; clear y,x,e,beta,s,tt; y = data[1:T,1]; n = rows(y); n1 = n-1; @ LOOP @ kloop=6; k=1; do until k == kloop; tt = seqa(1,1,n); z = 2*pi*tt*k/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 ; ssr_min = 10000000.0; ssr = e'e; if ssr <= ssr_min; ssr_min = ssr; endif; " ssr = " ssr_min " KPSS_Fourier frequency = " k; k = k + 1; endo; isw = isw + 1; endo; /* end of BIG-BIG Loop */ @ ---- References -----@ @ ---- Becker, R., Enders, W., and Lee, J. (2006) ---------------- @ @ ---- Kwiatkowski and Schmidt (1990) ---------------------------- @ @ ---------------------------------------------------------------- @