Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: multiple rolling regressions


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: multiple rolling regressions
Date   Thu, 8 May 2008 07:58:40 -0400

webuse grunfeld, clear
g double ipred = .
qui forv i = 1/10 {
	reg invest year if company==`i'
	predict double ihat if e(sample), resid
	reg mvalue year if company==`i'
	predict double mhat if e(sample), resid
	reg ihat mhat if company==`i', noco
	predict double xb if e(sample), xb
	replace ipred = xb if company==`i'
	drop ihat mhat xb
}
The series ipred will be the predicted value of invest (demeaned by firm). You could save the coefficients/standard errors in a matrix if you wish.

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/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index