Group g lnm2 lny r lnex
table ZAZ
vector(4) lags
for !kk = 1 to g.@count
%name = g.@seriesname(!kk)
series Y = {%name}
ZAZ(1,1) = "Variables"
ZAZ(3,1) = "t-stat"
ZAZ(4,1) = "Lag"
ZAZ(5,1) = "Breaks1"
ZAZ(6,1) = "DU1 p-value"
call zivot(Y)
ZAZ(1,1+!kk) = %name
ZAZ(3,1+!kk) = !t_min
ZAZ(4,1+!kk) = !final_lag
ZAZ(5,1+!kk) = breaks(1)
ZAZ(6,1+!kk) = @tdist(za.@tstat(4),za.@regobs-za.@ncoef) 'I would prefer t-statistics, since this will yield very small p-values.
setline(ZAZ, 2)
next
show ZAZ
subroutine zivot(series y)
!trim = 0.15 'Trimming parameter
!t_min = 1000
!min_aic = 1000
vector(1) breaks
series DY = D(Y)
for !lag=0 to 4
for !i = @round(@obs(Y)*!trim) to @round(@obs(Y)*(1-!trim))
if !lag = 0 then
equation temp.ls DY Y(-1) C @trend (@trend>!i)
else
equation temp.ls DY Y(-1) C @trend (@trend>!i) DY(-1 to -!lag)
endif
if temp.@aic < !min_aic then
!best_lag = !lag
!min_aic = temp.@aic
if temp.@tstats(1) < !t_min then
!t_min = temp.@tstats(1)
breaks(1) = !i+2 'Identified first break point.
series DU1 = @trend> !i
if !best_lag = 0 then
equation ZA.ls DY Y(-1) C @trend DU1 'Selected equation
!final_lag=!best_lag
else
equation ZA.ls DY Y(-1) C @trend DU1 DY(-1 to -!best_lag) 'Selected equation
!final_lag=!best_lag
endif
endif
endif
next
next
delete temp
endsub
把上面Group 的变量名称改成你自己的就可以了,这是ZAtest的程序。
来源:
http://forums.eviews.com/viewtop ... Zivot+Andrews#p3173