Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: keeping cointegrating parameters

From   Christopher Baum <>
To   "" <>
Subject   Re: st: keeping cointegrating parameters
Date   Mon, 8 Oct 2012 17:58:56 +0000

Jeremy said

I am running a rolling vector error correction model and want to evaluate the stability of the adjustment parameters (alpha) and the cointegrating parameters (beta). 
The issue though is that when I use:
"rolling, recursive window(10): vec cpiINF lendingrate borrowingrate l_capital l_production l_loans, lags(5) rank(2) alpha bconstraints(1/5) aconstraints(6/9) nolog", the only variables that are left are all the short term variables.
Is there a way to tell Stata to keep the alpha and beta parameters that are stored in the results from a typical "vec"? With "vec" they are stored as e(alpha), e(beta) respectively.

The complication here is that e(alpha) and e(beta) are matrices. The exp_list supported by -rolling- can only contain scalars, but can contain any number of them. You need a "wrapper program" strategy similar to that of -myregress- in itsp.ado (findit myregress), as discussed in ITSP (Baum, 2009). Here is a quick and dirty hack of -myregress-:

capt prog drop myvec
program myvec, rclass
version 12
syntax varlist(ts) [if] [in]
vec `varlist' `if' `in'
mat alpha = e(alpha)
loc nc = colsof(alpha)
forv i=1/`nc' {
	ret sca alpha`i' = alpha[1,`i']
mat beta = e(beta)
loc nc = colsof(beta)
forv i=1/`nc' {
	ret sca beta`i' = beta[1,`i']

webuse rdinc
// test the program to see if it sends back the right stuff
myvec ln_ne ln_se
ret li

rolling alpha1=r(alpha1) alpha2=r(alpha2) beta1=r(beta1) beta2=r(beta2) beta3=r(beta3), ///
 recursive window(10): myvec ln_ne ln_se


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index