Page 1 of 1

Autolagselect for series

Posted: Mon Sep 14, 2015 8:50 pm
by yelena
Dear Tom,
I have a quesiton about how to display the AIC optimal lags for each series in a table. I have written the code:

dofor i = DEPENDENT RGDP UR CPI TR3M TR10Y CRE HPI OIL BAA SP500
@ADFAutoSelect(det=NONE, crit=AIC, maxlag=6, TITLE="Dickey-Fuller Unit Root Test (NONE):" + %l(i), print) i sambeg samend
compute Lagselect = %%LAGS
dis 'Lags:' %l(i) 'Lagselect = ' %%LAGS
end dofor

But then need to create a table where I have series in one column and optimal lags numbers in another column. Somehow I cannot find the syntax to use it.

Thank you very much.

Re: Autolagselect for series

Posted: Tue Sep 15, 2015 7:07 am
by TomDoan
Use REPORT, as in:

Code: Select all

report(action=define,title="Selected Lag Lengths")
report(atrow=1,atcol=1) "Variable" "Lags"
dofor i = DEPENDENT RGDP UR CPI TR3M TR10Y CRE HPI OIL BAA SP500
   @ADFAutoSelect(det=NONE, crit=AIC, maxlag=6, TITLE="Dickey-Fuller Unit Root Test (NONE):" + %l(i), print) i sambeg samend
   report(row=new,atcol=1) %l(i) %%lags
end dofor
report(action=show)

Re: Autolagselect for series

Posted: Tue Sep 15, 2015 12:18 pm
by yelena
Oh, it works! Fantastic! Thank you SO much, Tom!