Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: save -predict- stats for each panel regression


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: save -predict- stats for each panel regression
Date   Tue, 17 Feb 2004 12:32:51 -0000

Various questions similar in the archives: 
for more details, search for -foreach- 
and -levels-. 

Also see 
http://www.stata.com/support/faqs/data/foreach.html

Let's suppose your panels are defined by -company- 
which takes integer values and to which value labels
are attached. The following indicates one line of 
attack: 

levels company, local(C) 
gen resid = . 
qui foreach c of local C {
    regress y x1 x2 x3 if company == `c' 
    predict temp, res
    replace resid = temp if company == `c' 
    drop temp 
} 

Nick 
[email protected] 

[email protected]
 
> I have a balanced panel dataset and I run individual 
> regressions for each
> panel(almost 7000 panels for 14 years).
> I wish to save the residuals, standard errors of prediction 
> and other -predict-
> statistics for each individual regressions, in a similar 
> manner as -egen-
> does.
> 
> I have searched the FAQ but didnt find something relevant,
> all suggestions are very welcome,

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