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 at the end of May, and its replacement, statalist.org 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 <kit.baum@bc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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']
}
end

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)
list
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


Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                             An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
  An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index