Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Predicted Probability after xtgee (urgent!!!)


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Predicted Probability after xtgee (urgent!!!)
Date   Thu, 19 Jul 2007 19:12:43 +0100 (BST)

--- ckang2@gmail.com wrote:
> Could you anyone teach me how to get predicted probability after
> running xtgee?

predicted values are usually obtained using the -predict- command.
 
> With searching the archives, some reconmmend to use mfx.
> For example, these are the results actually I got by running mfx
> after xtgee.
> 
> arginal effects after xtgee
>       y  = xb (predict)
------------------------------------------------------------------------------
> variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ] 
>     X
---------+--------------------------------------------------------------------
> x1        |    .002552      .00662    0.39   0.700  -.010432  .015536
>   .580848
> x2        |   1.88e-09      .00000    1.79   0.073  -1.8e-10  3.9e-09
>    304447
> 1) how is it possible that x2's dy/dx is over 1? I think dy.dx is odd
> ratio. Am I right?

No, but close. Marginal effects play a similar rol as odds ratios: they
show the strength of the effect. In this case it shows by how much the
linear predictor changes when the explanatory variable changes one
unit, while fixing all other variables at their mean if the size of the
effect doesn't change over the unit range. You can see that by looking
at the top line of the output where it says "y = xb (predict)". If they
were odds ratios than the number could easily be larer than one (that
would mean a positive effect, one would mean no effect, and between
zero and one a negative effect, negative numbers are not possible).
Changes in the linear predictor, the thing that is measured in the
output, can easily be larger than one. Even if we compute marginal
effects in terms of the probability it can still be larger than one,
since the marginal effect assumes that the effect doesn't change (it is
the first derivative or the slope evaluated at that point). Finally the
number you are refering to isn't larger than one, it is: 1.88e-09, the
e-09 part means that you have to move the decimal point 9 places to the
left, so it is actually 0.00000000188.

> 2) what does "X" in the last column of the first raw mean?

In non-linear models you have to fix the values of the explanatory
variables at some number (usually the mean). The X column shows the
value at which the explanatory variable is fixed.

> 3) is there any other way (STATA command like "prvalue" or "estsimp")
> to get predicted probability varying across the change of x (I.v.)?

Yes, the trick is that -predict- will work on a different dataset as
long as it contains variables with the same variable names. So you can
replace some variables with their mean or some other value, and using
predict you will now get predicted values while some variables change
and others are fixed at their mean. This is best explained using an
example:

*------------- begin example --------------------
use http://www.stata-press.com/data/r9/nlswork2.dta, clear
xtgee union south hours collgrad age, i(idcode) t(year)
family(binomial)

preserve
replace collgrad = 1 
replace age = 25
collapse collgrad age, by(south hours)
predict mu, mu
label var mu "predicted prob of union membership"

list in 1/20

twoway line mu hours if south == 1, sort || /*
    */ line mu hours if south == 0, sort /*
    */ legend(lab(1 "South") /*
          */  lab(2 "Non-south"))
restore
*------------------ end example ------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

In this example I quite drastically change the data in a way that I
want to use to create a graph, but I do not want save it. This is what
the -preserve- and -restore- commands are for. To get an idea about
what the data look like once I changed it -list-ed the first 20
observations. I used -collapse- to make sure I had only one observation
for each value of hours and south. This is a trick that results in
graphs that use less memory. 

Hope this helps,
Maarten


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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