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 
 
Scott Merryman <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: Regression by industry and year excluding firm i 
Date 
 
Fri, 13 Dec 2013 12:00:31 -0600 
On Fri, Dec 13, 2013 at 11:33 AM, Abdalla, Ahmed
<[email protected]> 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/