options crt; name kwunit 'Unit Root Test with Null of Trend-Stationarity' ; ? ? Test from Kwiatkowski et al, Journal of Econometrics (1992), ? pp.159-178. ? Nelson-Plosser annual data from Perron. ? Reproduces Table 5 on p.174 of the article. ? TSP 4.2B (October 1993) ? Author: Clint Cummins ? in perron; freq a; smpl 1860,1970; trend t 1860; s = 0; copy s y; copy s e; set LMAX = 8; set LM1=LMAX+1; mform(nrow=1,ncol=LM1) etamu=0; copy etamu etatau; frml eqe e = emean; param emean; ? supres nob logl coef smpl phi; ? kwunit rgnp 1909; kwunit ngnp 1909; kwunit rpcgnp 1909; kwunit iprod 1860; kwunit emply 1890; kwunit unemp 1890; kwunit gnpdefl 1889; kwunit pcons 1860; kwunit nwage 1900; kwunit rwage 1900; kwunit money 1889; kwunit veloc 1869; smpl 1900,1970; expint = exp(interest); ? Don't use the log of interest rate. kwunit expint 1900; kwunit pstock 1871; ? ? ====================================================================== ? proc kwunit y0 t1; smpl t1,1970; ? Period over which test is done. y = log(y0); olsq(silent) y c; eta etamu t1; olsq(silent) y c t; eta etatau t1; print etamu,etatau; endproc kwunit ; ? ? ===================================================================== ? proc eta etai t1; ? ? Calculate eta test statistic (must be run immediately following OLS). ? smpl t1,t1; s = @res; set t2=t1+1; smpl t2,1970; s = s(-1) + @res; ? cumulative sum of residuals smpl t1,1970; inprod s s s2; set tpm2 = 1/(@nob*@nob); e = @res; do L=0,LMAX; if L=0; then; set s2L = @ssr/@nob; else; do; gmm(nma=L,inst=c,het,silent) eqe; ? Bartlett kernel is default set s2L = @covoc; enddo; set L1 = L+1; set etai(L1) = tpm2*s2/s2L; enddo; endproc eta ; ? ? =======================================================================