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: saving residuals for many regressions
From
Maarten buis <[email protected]>
To
[email protected]
Subject
Re: st: saving residuals for many regressions
Date
Thu, 25 Nov 2010 19:24:13 +0000 (GMT)
--- On Thu, 25/11/10, Rodrigo Briceño wrote:
> Now, I have a different challenge: I need to create a table
> with the residuals of all the 97 regressions to be read in excel.
<snip>
>
> The second question is if there is possible to save the 97
> graphs (of the residuals) to be created.
*--------------- begin example -----------------
sysuse auto, clear
recode rep78 1 = 2
levelsof rep78
local levs `"`r(levels)'"'
gen resid = .
foreach lev of local levs {
reg price mpg foreign if rep78 == `lev'
predict resid_t if e(sample), resid
replace resid = resid_t if e(sample)
twoway scatter resid_t mpg, name(gr_`lev')
drop resid_t
}
*----------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/