VARLAGSELECT - Automatic lag selection in a VAR

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

VARLAGSELECT - Automatic lag selection in a VAR

Postby TomDoan » Tue Nov 13, 2012 9:15 am

Attached is a revised version of the VARLAGSELECT procedure for selecting the lag length in a VAR using one of several techniques.

varlagselect.src
Procedure file
(5.81 KiB) Downloaded 135 times


@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"||)


realrates.xls
Data file for example
(41 KiB) Downloaded 57 times
TomDoan
 
Posts: 2717
Joined: Wed Nov 01, 2006 5:36 pm

Re: VARLAGSELECT - Automatic lag selection in a VAR

Postby hasanov » Wed Nov 14, 2012 9:56 pm

Hello Tom,
Thanks for the revised procedure.
Similar aspect:
Is it possible to extend this procedure to VARMA-type models?

Regards,
Akram Hasanov
hasanov
 
Posts: 7
Joined: Tue May 29, 2012 7:31 pm

Re: VARLAGSELECT - Automatic lag selection in a VAR

Postby TomDoan » Thu Nov 15, 2012 12:21 pm

hasanov wrote:Hello Tom,
Thanks for the revised procedure.
Similar aspect:
Is it possible to extend this procedure to VARMA-type models?

Regards,
Akram Hasanov


Not really. Automatic selection of VARMA(p,q) models is generally not a good idea because once you get beyond p=1, q=1 there are all kinds of problems with lack of identification due to cancellation. Plus, VAR's have a simple closed form calculation for their likelihood, while VARMA's require non-linear optimization for each model combination.
TomDoan
 
Posts: 2717
Joined: Wed Nov 01, 2006 5:36 pm


Return to RATS Procedures

Who is online

Users browsing this forum: No registered users and 1 guest