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

Re: st: hausman and xthausman after panel fe, re - DROPPED MEAN/DIFF


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: hausman and xthausman after panel fe, re - DROPPED MEAN/DIFF
Date   Fri, 26 Aug 2005 08:55:55 -0500

In adding the ability to handle missing values to Mark Schaffer
<M.E.Schaffer@hw.ac.uk> and Carl Nelson's <chnelson@uiuc.edu> 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
   vwiggins@stata.com

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index