/*------------------------------------------------------------------------------------------- ESTARUTSC.PRC Purpose: UNIT ROOT TEST AGAINST STATIONARY ESTAR (Serially Correlated) H0: Driftless Random Walk H1: Stationary Exponential Smooth Transition Autoregressive Written by Hyeongwoo Kim (MAR 3, 2004) ------------------------------------------------------------------------------------------- Format: tr = estarutsc(y,p,c); Input : y (nX1) Vector of Time Series to be Tested p (1x1) number of lags to be included c=0 No Constant =1 Include Constant (Use Demeaned Data) =2 Include Constant and Linear Time Trend (Use Demeaned and Detrended Data) Output: tr (1x1) Nonlinear ADF t-statistic -------------------------------------------------------------------------------------------*/ proc(1) = estarutsc(y,p,c); local t,dy,yc,n,x,i,df,xc,b,rsd,ssq,vcb,se,tr; ""; " * H0: Driftless Random Walk";; " H1: Stationary ESTAR ";""; " - asymptotic critical values (t-ratio) from Kapetanious et. al (2003) -"; "------------------------------------------------------------"; " 1% 5% 10% Model (Serially Correlated Errors)"; "------------------------------------------------------------"; "-2.82 -2.22 -1.92";; " Simple NLADF (no constant or trend)"; "-3.48 -2.93 -2.66";; " NLADF with constant (no trend)"; "-3.93 -3.40 -3.13";; " NLADF with constant & trend"; "------------------------------------------------------------";""; if c eq 1; t = ones(rows(y),1); y = y - t*inv(t't)*t'y; endif; if c eq 2; t = ones(rows(y),1)~seqa(1,1,rows(y)); y = y - t*inv(t't)*t'y; endif; dy = trimr(y,1,0)- trimr(y,0,1); n= rows(dy); x = zeros(n-p,p); i = 1; do until i > p; x[.,i] = trimr(dy,p-i,i); i = i + 1; endo; dy = trimr(dy,p,0); yc = trimr(y,p,1).^3; xc = yc~x; df = rows(dy)- cols(xc); b = inv(xc'xc)*xc'dy; rsd = dy - xc*b; ssq = (rsd'rsd)/df; vcb = ssq*inv(yc'yc); se = sqrt(diag(vcb)); tr = b./se; tr = tr[1]; retp(tr); endp;