Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

re: RE: st: keeping cointegrating parameters

From   Christopher Baum <>
To   "" <>
Subject   re: RE: st: keeping cointegrating parameters
Date   Mon, 8 Oct 2012 19:56:14 +0000

Jeremy said

The only issue I'm having with the program is that it doesn't seem to allow me to use any form of options with my "vec" and I have a fair amount.  Is there a way to adapt the myvec to allow for options such as lags, rank, and constraints on my A and B matrices?

No problem. Anything a Stata command can do, you can do with the syntax statement.

capt prog drop myvec
program myvec, rclass
version 12
syntax varlist(ts) [if] [in] [, *]
vec `varlist' `if' `in', `options'
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,clear
myvec ln_ne ln_se, lags(3) rank(1)
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, lags(3) rank(1)
tsset end, yearly
tsline alpha1 alpha2, scheme(s2mono) nodraw name(alpha, replace)
tsline beta2 beta3, scheme(s2mono) nodraw name(beta, replace)
graph combine alpha beta


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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index