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

From |
May Boggess <mboggess@stata.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: re: reporting odds for N categories |

Date |
Tue, 27 Sep 2005 10:35:40 -0500 |

On Tuesday morning Dan asked about different ways to graph odds after running a logistic model:

To extend the example, we could randomly assign a sex category to the cases. next, if we repeated the logit modelling with sex as an additional explanatory variable, and use the same approach to graph the data, there will be 2 points for each alcohol category (1 each for each sex, for age==3). ....There are lots of different possibilities for graphs after a logistic model and, if Dan wishes, he can mail me off the list for further help.

Is there a way which we can efficiently graph the results for each age group/sex combination, without using the KEEP command?

Are there better ways to graph the results if there is more than 2 (categorical) explanatory variables?

But here is one more example.

I admit, using -keep- was the lazy way. Another way is to use the -if- qualifier in the -twoway- command, as I have done here:

clear

webuse bdesop

expand freq

gen gender=uniform()>0.5

tab gender

xi:logit case i.alc agegrp gender

predictnl odds=predict(p)/(1-predict(p)), ci(lb ub)

label var odds "odds"

tabdisp alc agegrp gender, c(odds)

#d;

sort alc;

twoway

rcap lb ub alc if gender==0 & age==3

|| connected odds alc if gender==0 & age==3

|| rcap lb ub alc if gender==1 & age==3

|| connected odds alc if gender==1 & age==3 ,

legend(order(2 4) label(2 "gender=0") label(4 "gender=1"))

title("Odds for age group 45-54, by gender");

#d cr

--May

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

**References**:**st: re: reporting odds for N categories***From:*Dan Exeter <d.exeter@st-andrews.ac.uk>

- Prev by Date:
**Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC** - Next by Date:
**st: Location of Stata icons in Windows** - Previous by thread:
**st: re: reporting odds for N categories** - Next by thread:
**st: Q-Q Plot** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |