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

Re: st: re: reporting odds for N categories

From   May Boggess <>
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). ....
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?

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.
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:

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)

sort alc;
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


* For searches and help try:

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