** Chapter 22 ** for W.H. Greene, Econometric Analysis 6th ed. ***************** * (c) Noel Roy 2008 * * NONSTATIONARY DATA * *=============================================================================== * 22.2 NONSTATIONARY PROCESSES AND UNIT ROOTS * * 22.2.5 The KPSS test of stationarity * * Example 22.4 Is There a Unit Root in GDP? * READ (TableF5-1.prn)Year qtr realgdp realcons realinvs realgovt realdpi cpi M1 i unemp pop pi realint / SKIPLINES=1 GENR y=LOG(realgdp) * Estimate time trend equation genr t=time(0) ols y t /resid=e gen1 n=$n gen1 sse=$sse * Estimate Newey-West estimate of sigma-squared. *Set L=10 gen1 L=10 * Estimate correction factors. gen1 nw=0 set nodoecho do !=1,L gen1 s=!+1 sample s n genr ee=e*lag(e,!) ?stat ee/sums=see gen1 nw=nw+(1-!/(L+1))*see(1)/n endo gen1 sig2=sse/n+2*nw print sig2 * Calculate KPSS statistic SAMPLE 1 n genr bige=e genr bige=e+lag(bige) genr bige2=bige**2 ?stat bige2 / sums=sbige2 gen1 kpss=sbige2(1)/n**2/sig2 print kpss * * The test statistic exceeds the 0.01 critical value of 0.216, * enabling us to reject the null hypothesis of stationarity. * * Repeat without trend ols y /resid=e gen1 sse=$sse gen1 nw=0 do !=1,L gen1 s=!+1 sample s n genr ee=e*lag(e,!) ?stat ee/sums=see gen1 nw=nw+(1-!/(L+1))*see(1)/n endo gen1 sig2=sse/n+2*nw print sig2 SAMPLE 1 n genr bige=e genr bige=e+lag(bige) genr bige2=bige**2 ?stat bige2 / sums=sbige2 gen1 kpss=sbige2(1)/n**2/sig2 print kpss * * Again, the test statistic exceeds the 0.01 critical value of 0.739. * stop * *=============================================================================== * Updated November 19, 2008