@VARLagSelect( options ) start end
# list of variables
Options
LAGS[/b]=(maximum) number of lags [1]
[b]DET=NONE/[CONSTANT]
Deterministic variables to include
CRIT=AIC/SBC/BIC/HQ/GTOS/[NONE]
Criterion to use in selecting the lag length (SBC and BIC are synonyms). GTOS does a general to specific pruning using LR tests dropping lags as long as the final one fails to be significant at the level indicated by the SIGNIF option. If NONE, it just estimates the model with the specified number of lags.
SIGNIF=marginal significance level used in GTOS pruning [.05]
MODEL=model to define from chosen lag length [not used]
[PRINT]/NOPRINT
TITLE=title for output ["VAR Lag Selection"]
Variables Defined
%%AUTOP = chosen number of lags
Example
This looks at the lag lengths picked using general-to-specific, AIC and SBC to examine the sensitivity to the criterion used.
- Code: Select all
*
* Enders, Applied Econometric Time Series, 3rd edition
* Example from Section 5.13
* SVAR example
* Pages 344-347
*
open data realrates.xls
calendar(q) 1973:1
data(format=xls,org=columns) 1973:01 2008:02 e_can e_ja e_uk p_ca p_ja p_uk p_us
*
set loge_uk = log(e_uk)
set logr_uk = loge_uk-log(p_uk)+log(p_us)
set dloge_uk = loge_uk-loge_uk{1}
set dlogr_uk = logr_uk-logr_uk{1}
*
linreg dloge_uk
# constant loge_uk{1} dloge_uk{1}
*
* The Elliott-Rothenberg-Stock test can be done using the ERSTEST
* procedure. The DF t statistic is the DFGLS value in the output.
*
@erstest(lags=1) loge_uk
*
* The VARLAGSELECT procedure can help choose the lag length. This does
* general-to-specific, which involves block likelihood ratio tests of
* the final lag.
*
@varlagselect(crit=gtos,lags=8)
# dlogr_uk dloge_uk
@varlagselect(crit=aic,lags=8)
# dlogr_uk dloge_uk
@varlagselect(crit=sbc,lags=8)
# dlogr_uk dloge_uk
*
system(model=xrates)
variables dlogr_uk dloge_uk
lags 1
det constant
end(system)
*
estimate
errors(model=xrates,steps=8)
errors(model=xrates,factor=%bqfactor(%sigma,%varlagsums),steps=8,labels=||"Real","Nominal"||)
