@ Written/Modified by: Junsoo Lee Disclaimer: This code is provided gratis without any guarantees or warrantees. Proprietary modifications of this code are not permitted. @ @ ---- program for K-S test ---------------- @ @ reference : Kwiatkowski and Schmidt (1990) @ @ written by J. Lee, Sep. 1990 @ @ ------------------------------------------- @ @ KPSS test @ closeall; format /m1/rd 10,3 ; output file = nelson.out reset; load data[111,15] = nelplos.dat; let ystart[15,1] = 1 50 50 50 1 31 31 30 1 41 41 30 10 41 12 ; let name = year rgnp gnp pcrgnp ip emp un prgnp cpi wg rwg m vel bnd_unl sp500 ; @ --- BIG-BIG Loop --- @ isw = 0; /* isw = 0 without trend , isw = 1 with trend */ do while isw < 2; if isw == 0; "";"";""; " ----- Test for drift stationarity ----"; else; "";"";""; " ----- Test for trend stationarity ----"; endif; @ BIG LOOP @ j = 1; /* j=2 to 15 : 14 series */ do until j == 15; j=j+1; clear y,x,e,beta,s,tt; st = ystart[j,1]; y = data[st:111,j]; n = rows(y); ""; ""; " Series : " $name[j,1]; " # of obs = " n; " first three unlogged obs. : " y[1:3,.]'; ""; if j /= 14; y = ln(y); endif; n1 = n - 1 ; tt = seqa(1,1,n); if isw == 0; x = ones(n,1) ; endif; if isw == 1; x = ones(n,1) ~ 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