Get rid of the unnecessary diaglogue box

For questions about EViews Add-ins available from the EViews Add-ins webpage. Note each add-in available on our webpage will have its own individual thread.

Moderators: EViews Gareth, EViews Moderator, EViews Esther

garch2012
Posts: 9
Joined: Sun Sep 22, 2013 5:57 pm

Get rid of the unnecessary diaglogue box

Postby garch2012 » Mon Sep 23, 2013 4:13 pm

I do not like diaglogue boxes and menus. How do I call Perron's test (the add-in) by the use of syntax WITHOUT getting the following unneccessary dialogue box:
Perron Dialogue box.docx
(20.39 KiB) Downloaded 746 times
Here is the code (which works, but it is a slow way to do it this way):

Code: Select all

wfcreate FILE u 1 200 genr y = nrnd y.ppuroot (lag=6,model=C) 'Perron Unit Root Test under Structural Change 'Reference: Perron, P., (1997), “Further Evidence on Breaking Trend Functions in Macroeconomic Variables”, Journal of Econometrics, 80, pp. 355-385. ' ---------------------------------------------------------------------------------------------------- ' Perron Subroutine - Arguments '----------------------------------------------------------------------------------------------------- 'series Y ' Dependent variable 'string %Model ' Location of the break ("A" = Intercept, "B" = Both, "C" = Trend) 'scalar Maxlag ' Maximum number of lags for unit root testing 'table zaz ' Name of table object to put results into. 'series sertstats ' t statistics for each possible break date ' ---------------------------------------------------------------------------------------------------- subroutine local perron(series y,string %Model,scalar maxlag, table zaz, series sertstats) local smpl series smplser = 1 series cumsum = @cumsum(smplser) !trim = 0.15 'Trimming parameter series DY = D(Y) !nobs = @obs(y)-maxlag-1 ' Calculate Optimum Lag (Method "t-sig") ' smpl @first+maxlag+1 @last smpl if cumsum>maxlag+1 and smplser=1 equation temp.ls dy c @trend y(-1) dy(-1 to -{maxlag}) !ktemp =maxlag + 3 !cont = 0 While (!cont = 0) if (temp.@tstats(!ktemp) > 1.96) or (temp.@tstats(!ktemp)< -1.96) then !best_lag = !ktemp - 3 !cont = 1 else if (!ktemp <> 3) then !ktemp = !ktemp - 1 else !best_lag= 0 !cont = 1 endif endif wend 'smpl @all smpl if smplser=1 !znobs = @obs(y) - !best_lag !lower = 1+!best_lag+@round(!znobs*!trim) !upper = @obs(y)-@round(!znobs*!trim) vector(!upper-!lower+1) results 'smpl @first + !best_lag @last smpl if cumsum>!best_lag and smplser=1 for !i = !lower to !upper if !best_lag=0 and %Model = "A" then equation temp.ls DY Y(-1) C @trend (@trend>!i-2) d((@trend>!i-2)) else if !best_lag=0 and %Model = "B" then equation temp.ls DY Y(-1) C @trend (@trend>!i-2) d((@trend>!i-2)) (@trend>!i-2)*(@trend + 1) else if !best_lag=0 and %Model = "C" then equation detrend.ls y c @trend (@trend>!i-2)*(@trend-!i+2) detrend.makeresids y_detrend equation temp.ls D(y_detrend) y_detrend(-1) else if !best_lag>0 and %Model = "A" then equation temp.ls DY Y(-1) C @trend (@trend>!i-2) d((@trend>!i-2)) DY(-1 to -!best_lag) else if !best_lag>0 and %Model = "B" then equation temp.ls DY Y(-1) C @trend (@trend>!i-2) d((@trend>!i-2)) (@trend>!i-2)*(@trend + 1) DY(-1 to -{!best_lag}) else if !best_lag>0 and %Model = "C" then equation detrend.ls y c @trend (@trend>!i-2)*(@trend-!i+2) detrend.makeresids y_detrend series DY_detrend = d(y_detrend) equation temp.ls DY_detrend y_detrend(-1) DY_detrend(-1 to -{!best_lag}) endif endif endif endif endif endif results(!i-!lower+1) = temp.@tstats(1) next smpl if cumsum>!lower-1 mtos(results,sertstats) vector t_min =@cmin(results) !t_min = t_min(1) vector break = @cimin(results)+!lower-1 !break = break(1) ZAZ(1,1) = "Variable(s)" ZAZ(3,1) = "t-stat(s)" ZAZ(4,1) = "Lag(s)" ZAZ(5,1) = "Break" ZAZ(1,2) = y.@name ZAZ(3,2) = !t_min ZAZ(4,2) = !best_lag if @datestr(@now,"F") = "?" then ZAZ(5,2) = !break else ZAZ(5,2) = @otod(!break) endif setline(ZAZ, 2) endsub

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Get rid of the unnecessary diaglogue box

Postby EViews Gareth » Mon Sep 23, 2013 4:42 pm

Code: Select all

y.ppuroot(lag=6,model=C)

garch2012
Posts: 9
Joined: Sun Sep 22, 2013 5:57 pm

Re: Get rid of the unnecessary diaglogue box

Postby garch2012 » Mon Sep 23, 2013 7:08 pm

OK, I added an extra space by mistake. Thanks!

However, still I often get zero lags when using this method (Perron, 1997). Shouldn't there be at least be a minimum of 1 lag (I am not sure, but it makes sense with at least one lag - to get rid of possible autocorrelation or to reduce the effects of omitted-variable bias which is always present in a univariate model)?

I think that I have read about problems with zero lags in a similar post in this forum (for another test), but I could not find it.

See the output where the optimal lag length is zero:
EViews output.pdf
(13.88 KiB) Downloaded 699 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Get rid of the unnecessary diaglogue box

Postby EViews Glenn » Tue Sep 24, 2013 9:12 am

I'm not commenting at all about the program and data at hand, but I will note that there is no reason to assume that the optimal lag length for the included differences is greater than zero in a standard unit root test.


Return to “Add-in Support”

Who is online

Users browsing this forum: No registered users and 1 guest