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]

st: predicting residuals in regression


From   Rudy Hover <[email protected]>
To   [email protected]
Subject   st: predicting residuals in regression
Date   Wed, 9 May 2012 17:53:51 +0200

I have panel on thousands of firms over 6 years. I want to regress using the foreach command:

gen residuals=.
levelsof permno, local(permnolist)

forvalues y=1999/2006 {
foreach f of local firmnolist {
reg VarA VarB if firmno==`f' & year==`y'
predict temp, residuals
replace residuals=temp if firmno==`f' & year==`y'
drop temp 
}
}

However I'm getting a variable residuals only containing missing values (.)
What am I doing wrong?
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index