Dear Kit,
This was truly helpful. However, it seems to me it is using the entire
data for each firm, while I need it to use only 5 year of data at a
time (rolling regression). I would appreciate if you have any
suggestions on how I could accomplish this additional result.
Regards,
Erasmo
On Thu, May 8, 2008 at 1:58 PM, Kit Baum <[email protected]> wrote:
> > 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/
>
*
* 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/