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" <[email protected]>
To
"[email protected]" <[email protected]>
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: [email protected] <[email protected]> on behalf of Scott Merryman <[email protected]>
Sent: 13 December 2013 18:00
To: [email protected]
Subject: Re: st: Regression by industry and year excluding firm i
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/
*
* 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/