In adding the ability to handle missing values to Mark Schaffer
<[email protected]> and Carl Nelson's <[email protected]> version of
artificial regression for a Hausman-like test, I failed to add the critical
-if e(sample)- condition to the -egen- command. Here is the corrected code.
---------------------------------- BEGIN --- artreg.do --- CUT HERE -------
local id idcode
local depvar ln_wage
local varlist ttl_exp union white
iis `id'
xtreg `depvar' `varlist' , re
local i 0
foreach var of varlist `varlist' {
egen mymean`++i' = mean(`var') if e(sample), by(`id')
}
xtreg `depvar' `varlist' mymean1-mymean`i' , re
testparm mymean1-mymean`i'
---------------------------------- END --- artreg.do --- CUT HERE -------
-- Vince
[email protected]
*
* 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/