st: re: running a foreach loop over a sequence of dates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

st: re: running a foreach loop over a sequence of dates

Christopher F Baum
<>
Carlo said

Dear Martin, Kit and All Statalisters interested in Kit's forthcoming  
textbook, not later than this morning, the Italian official Stata  
dealer reported me April as an expected availability for this highly  
welcomed volume!

Unless shipping is by very slow boat, I think this is unduly  
pessimistic. I am assured that a final copy for my approval will be in  
hand shortly, and the Stata Press website http://stata-press.com/forthcoming.html 
  lists January 2009 as the expected publication date. I would not  
think that sales to distributors overseas would be delayed that far  
behind the fulfillment of US sales.

As threatened, here is an example of "rolling your own":
capture program drop myregress
program myregress, rclass
version 10.1
syntax varlist(ts) [if] [in], LAGVar(string) NLAGs(integer)
regress `varlist' `if' `in'
local nl1 = `nlags' - 1
forvalues i = 1/`nl1' {
        local lv "`lv' L`i'.`lagvar' + "
}
local lv "`lv' L`nlags'.`lagvar'"'
lincom `lv'
return scalar sum = `r(estimate)'
return scalar se = `r(se)'
end

This command may then be used as the target of a -rolling- command. It  
will save two scalars per turn of the crank: the estimate of the sum  
of lag coefficients and its standard error.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Reply | Threaded
Open this post in threaded view
|

st: R: re: running a foreach loop over a sequence of dates

Carlo Lazzaro

Dear Kit,
due to my gasping skills in Stata programming, I do hope that you are right!


Kind Regards,
Carlo

-----Messaggio originale-----
Da: [hidden email]
[mailto:[hidden email]] Per conto di Christopher Baum
Inviato: giovedì 4 dicembre 2008 17.56
A: [hidden email]
Oggetto: st: re: running a foreach loop over a sequence of dates

<>
Carlo said

Dear Martin, Kit and All Statalisters interested in Kit's forthcoming  
textbook, not later than this morning, the Italian official Stata  
dealer reported me April as an expected availability for this highly  
welcomed volume!

Unless shipping is by very slow boat, I think this is unduly  
pessimistic. I am assured that a final copy for my approval will be in  
hand shortly, and the Stata Press website
http://stata-press.com/forthcoming.html 
  lists January 2009 as the expected publication date. I would not  
think that sales to distributors overseas would be delayed that far  
behind the fulfillment of US sales.

As threatened, here is an example of "rolling your own":
capture program drop myregress
program myregress, rclass
version 10.1
syntax varlist(ts) [if] [in], LAGVar(string) NLAGs(integer)
regress `varlist' `if' `in'
local nl1 = `nlags' - 1
forvalues i = 1/`nl1' {
        local lv "`lv' L`i'.`lagvar' + "
}
local lv "`lv' L`nlags'.`lagvar'"'
lincom `lv'
return scalar sum = `r(estimate)'
return scalar se = `r(se)'
end

This command may then be used as the target of a -rolling- command. It  
will save two scalars per turn of the crank: the estimate of the sum  
of lag coefficients and its standard error.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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