Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Regression by industry and year excluding firm i


From   "Abdalla, Ahmed" <ahmed.abdalla@kcl.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Regression by industry and year excluding firm i
Date   Fri, 13 Dec 2013 19:09:31 +0000

I forgot to mention that I have a total of 95,000 observations. After 45 minutes, I enforced STATA to stop(break) and I realized that some values have been reported in b0 to b6.. I am not sure if this is normal ? Do you think that the code should be OK ? also do I need to write } } } (three times) at the end. I believe that you closed each loop above, so why do you write this again at the end.

Many thanks



________________________________________
From: owner-statalist@hsphsun2.harvard.edu <owner-statalist@hsphsun2.harvard.edu> on behalf of Scott Merryman <scott.merryman@gmail.com>
Sent: 13 December 2013 18:00
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Regression by industry and year excluding firm i

On Fri, Dec 13, 2013 at 11:33 AM, Abdalla, Ahmed
<ahmed.abdalla@kcl.ac.uk> wrote:
> Dear Statalist
> I run a regression to estimate core earnings for each variable in my dataset. The regression is run using all observations in a particular industry year EXCLUDING firm i. Expected core earnings for firm i is estimated using the coefficients multiplied by the actual values of variables in the model for firm i.

<snip>

Do you mean something like this:


webuse grunfeld,clear
gen invest_hat  = .
levelsof company, local(levels)
foreach l of local levels {
   reg invest mvalue kstock if company != `l'
   predict fitted if company == `l'
   replace invest_hat = fitted if company == `l'
   drop fitted
}

Scott

*
*   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/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index