Autolagselect for series

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
yelena
Posts: 31
Joined: Wed Sep 09, 2015 8:49 pm

Autolagselect for series

Unread post 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.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Autolagselect for series

Unread post 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)
yelena
Posts: 31
Joined: Wed Sep 09, 2015 8:49 pm

Re: Autolagselect for series

Unread post by yelena »

Oh, it works! Fantastic! Thank you SO much, Tom!
Post Reply