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]

Re: st: predict residuals in Stata 10


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: predict residuals in Stata 10
Date   Thu, 25 Mar 2010 07:33:37 -0700 (PDT)

--- On Thu, 25/3/10, Marco Buur wrote:
> I would like to predict residuals after xtreg  command
> (Stata 10) in order to use meanonly residuals for Duan 
> smearing antilog transformation

The problem is that you did not model the thing you were
interested in, you modeled E(log(y)) instead of log(E(y)).
So the elegant solution is to estimate the right model
to begin with, rather than trying to clean up the mess 
that is the result of estimating the wrong model. In 
non-panel data you do that by estimating a -glm- using 
the untransforemed explained/dependent/y variable and 
the -link(log)- option. The generalizaiton to panel data 
would be -xtgee-.

*------------------- begin example ------------------------
webuse nlswork, clear
gen wage = exp(ln_wage)
gen baseline = 1
xtgee wage south union wks_ue grade collgrad baseline, ///
      link(log) eform nocons
*--------------------- end example ------------------------
(For more on examples I sent to the Statalist see: 
http://www.maartenbuis.nl/example_faq )

So the average wage for someone from the south, non-union, 
no unemployment in the last year, etc is $2.01 an hour. In
the south that is 100*(.895-1) = -10.4% less, while for 
Union member it is 14% more, etc. If you use -predict-, it 
will give you the average wage by default.

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/


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