Page 1 of 1

How to display significance levels for 1%, 5%, 10% in loop

Posted: Tue Sep 15, 2015 5:01 pm
by yelena
Dear Tom,

I have two questions:
I am trying to create a table "Variable", "ADF Lags", "DF Unit Root Test", "1% Crit Value", "5% Crit Value", "10% Crit Value" for each series in the loop. So my queestions are:
(1) how to display crit values for DF Unit root test
(2) how to do two loops and display the results in a table
(3) Also, I want to use l(i) instead of lisiting all the names of the variables in the header as they may change later.
I wrote the following code but it does not work:

report(action=define)
report(atrow =1, fillby=cols) "Variable" "DEPENDENT" "RGDP" "UR" "CPI" "TR3M" "TR10Y" "CRE" "HPI" "OIL" "BAA" "SP500"
dofor i = DEPENDENT RGDP UR CPI TR3M TR10Y CRE HPI OIL BAA SP500
@ADFAutoSelect(DET=NONE, MAXLAG = 6, CRIT=AIC, PRINT, TITLE="Dickey-Fuller Unit Root Test (NONE):" + %l(i)) i sambeg samend
report(col=new,atrow=1,fillby=cols) "ADF Lags" %%lags
@dfunit(DET=NONE, LAGS=%%lags, METHOD = AIC, SIGNIF = 0.05, PRINT, TITLE = "Dickey-Fuller Unit Roots Test (NONE), Series " + %l(i)) i sambeg samend
report(col=new,atrow=1,fillby=cols) "DF Unit Root" %%cdstat

end dofor
report(action=show)



I tried to do it another way but it does not work either

report(action=define)
report(atrow =1, hlabels=||"Variable", "ADF Lags", "DF Unit Root"||)
dofor i = DEPENDENT RGDP UR CPI TR3M TR10Y CRE HPI OIL BAA SP500
@ADFAutoSelect(DET=NONE, MAXLAG = 6, CRIT=AIC, PRINT, TITLE="Dickey-Fuller Unit Root Test (NONE):" + %l(i)) i sambeg samend

report(row=new,atcol=1) %l(i) %%lags
@dfunit(DET=NONE, LAGS=%%lags, METHOD = AIC, SIGNIF = 0.05, PRINT, TITLE = "Dickey-Fuller Unit Roots Test (NONE), Series " + %l(i)) i sambeg samend
report(row=new,atcol=2) %l(i) %%cdstat

end dofor
report(action=show)

Re: How to display significance levels for 1%, 5%, 10% in lo

Posted: Tue Sep 15, 2015 10:09 pm
by TomDoan
You don't need to use ADFAUTOSELECT, since DFUNIT by itself will select the lag lengths. The advantage of ADFAUTOSELECT is that it shows several criteria at once, but if you're just taking the automatic values for a specific criterion, DFUNIT is fine.

You can get the critical values with @MACKINNONCV.

As in the previous example, the way to handle this is to add a row each pass through the loop.

Code: Select all

report(action=define)
report(atrow=1,atcol=1) "Variable" "ADF Lags" "DF Unit Root Test" "1% Crit Value" "5% Crit Value" "10% Crit Value"
dofor i = DEPENDENT RGDP UR CPI TR3M TR10Y CRE HPI OIL BAA SP500
    @dfunit(DET=NONE,MAXLAGS=6,METHOD=AIC,NOPRINT) i
    @mackinnoncv(det=noconst) dfcv
    report(row=new,atcol=1) %l(i) %%autop %cdstat  dfcv(1) dfcv(2) dfcv(3)
end dofor
report(action=show)

Re: How to display significance levels for 1%, 5%, 10% in lo

Posted: Wed Sep 16, 2015 12:46 am
by yelena
Tom, you are fantastic! Thank you so much for your help. Also, I use your manuals but is there any other new textbooks that you'd recommend to learn RATS?