Statalist


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

Re: st: RE: graphing predicted probabilities after xtmelogit


From   Daniel Rubenson <rubenson@politics.ryerson.ca>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: graphing predicted probabilities after xtmelogit
Date   Sun, 16 Mar 2008 23:22:08 -0400

Hi Maarten (and others),

I'm not sure your suggestion does what I want. Don't I have to make new predictions for the different values of my variable, minority (instead of simply plotting minority==0 and minority==1)?

And let's say I also want 95%CI for the plots?

I've been trying out various versions of the following, to no avail. Something is clearly going wrong.

xtmelogit voted minority age age2 female educ meaninc percentuni racfrac || group:, var

adjust minority=0 if e(sample)
predict lr_index0, xb
adjust minority=0 if e(sample)
predict se_index0, stdp
gen lb0 = lr_index0 - invnorm(0.975)*se_index0
gen ub0 = lr_index0 + invnorm(0.975)*se_index0
gen plb0 = exp(lb0)/(1+exp(lb0))
gen pub0 = exp(ub0)/(1+exp(ub0))
gen line0= exp(lr_index0)/(1+exp(lr_index0))

adjust minority=1 if e(sample)
predict lr_index1, xb
adjust minority=1 if e(sample)
predict se_index1, stdp
gen lb1 = lr_index1 - invnorm(0.975)*se_index1
gen ub1 = lr_index1 + invnorm(0.975)*se_index1
gen plb1 = exp(lb1)/(1+exp(lb1))
gen pub1 = exp(ub1)/(1+exp(ub1))
gen line1 = exp(lr_index1)/(1+exp(lr_index1))

twoway (rarea plb0 pub0 racfrac, sort color(gs14)) (line line0 racfrac, sort lpattern(dot)) (rarea plb1 pub1 racfrac, sort color(gs14)) (line line1 racfrac, sort lpattern(full)), legend(on order(1 "non minority" 2 "visible minority")) legend(title("Minority")) yscale(range(0 1)) yline(.5, lpattern(vshortdash)) ytitle("Prob(vote)")



On 16-Mar-08, at 4:20 PM, Maarten buis wrote:

In the example below I show the probabilities for contraceptive use
when there are no children (the dummies child1-child3 are all set to
zero). If you had a continuous variable in there called x you can fix
that at the mean by typing:

adjust child1=0 child2=0 child3=0 x, gen(xb)

or fix it manually at some meaningful value, like was done with the
dummies.

Hope this helps,
Maarten

*------------- begin example -------------
webuse bangladesh, clear
xtmelogit c_use urban age child* || district:

adjust child1=0 child2=0 child3=0, gen(xb)
gen pr = invlogit(xb)
sort urban age
twoway line pr age if urban == 0 || ///
line pr age if urban == 1, ///
legend(order(1 "rural" ///
2 "urban" ))
*------------- 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 )

--- Nick Cox <n.j.cox@durham.ac.uk> wrote:

Given the other predictors, predictions will not be smooth functions
of -racfrac-. Or do you want some kind of adjustment first, or a plot
of partial predictions?

Daniel Rubenson

I have a question about xtmelogit postestimation and graphing. I have

estimated the following model:

. xtmelogit voted minority age age2 female educ meaninc percentuni
racfrac || group:, var

and I want to produce a graph of predicted probabilities of voting
when minority=1 and minority=0 with racfrac (an index of racial
fractionalization) on the x-axis. So, I want to graph the effect of
racfrac on voted for both categories of minority. Does anyone have
any suggestions (and syntax) for how to do this? I have tried lots of

things, none of which seem to work.

-----------------------------------------
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/
-----------------------------------------


     ___________________________________________________________
Rise to the challenge for Sport Relief with Yahoo! For Good

http://uk.promotions.yahoo.com/forgood/
*
*   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/

*
*   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