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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: reporting odds for N categories |

Date |
Thu, 22 Sep 2005 21:53:01 +0100 |

In May's last example, a log scale works well too: #d ; twoway rcap lb ub alc || connected odds alc, legend(off) sort title("Odds for age group 45-54") ysc(log) yla(.1 "0.1" .2 "0.2" .5 "0.5" 1 2, ang(h)) ; #d cr As the plot is then of log odds, this is also a logit scale, but with labelling in terms of odds. (Do tell me if there is any biostatistical solecism in my suggestion!) Nick n.j.cox@durham.ac.uk May Boggess > On Thursday morning, Dan asked about odds and odds ratios: > > > > I have a cross sectional dataset which reports the health > outcomes and > > covariate information for patients belonging to Z clinics. > > > > I am trying to compare the performance (ie. % of patients > in a clinic > > that failed health outcome) for each of the Z clinics, but > can not find > > a way that I can produce results suitable for graphing from > either the > > logistic or tabodds commands, as the reference group is, by > default, the > > clinic with the lowest numeric ID. > > > > How can I set the reference category to the mean, so that I > can graph > > the odds of failing, controlling for A and B, for each of > the Z clinics > > in the dataset? > > > > Dan has asked a few different things, but here I'll just > concentrate on > one aspect of his question: how to graph odds. > > One can use the epitab command -tabodds- to calculate odds. > For example: > > clear > webuse bdesop > expand freq > tabodds case alc > di " p= " 40/(40+386) > di "odds= " (40/(40+386))/(1- 40/(40+386)) > > The last two lines remind us how odds are calculated: odds=p/(1-p). > We can use a logistic model to obtain the same results. The > reason to do > that is that we can get the probabilities, and thus odds, as > variables > in the dataset: > > clear > webuse bdesop > expand freq > tabodds case alc > xi:logit case i.alc > predict p > gen odds=p/(1-p) > tabdisp alc, c(p odds) > > Now -twoway- can be used to create a graph: > > twoway scatter odds alc > > In order to be able to compare odds, we need confidence intervals as > well. I find the easiest way is to use -predictnl- instead of > -predict-, since it can calculate the confidence intervals as well: > > clear > webuse bdesop > expand freq > tabodds case alc > xi:logit case i.alc > predictnl odds=predict(p)/(1-predict(p)), ci(lb ub) > label var odds "odds" > tabdisp alc, c(odds lb ub) > > Notice that in the intervals we produce this way are close to but not > exactly the same as those that -tabodds- calculates (which are from > Clayton and Hills "Statistical Models in Epidemiology" (1993) p. 169). > > Again I can use -twoway- to get a graph: > > twoway rcap lb ub alc || connected odds alc, legend(off) sort > > This is essentially the same as the graph we can obtain from > -tabodds- > using the -ciplot- option. Why go to all this trouble then? > > So we can go a little further. In Dan's case he needs to > adjust for some > covariates. In example dataset I have agegrp to adjust for: > > clear > webuse bdesop > expand freq > tabodds case alc > xi:logit case i.alc agegrp > predictnl odds=predict(p)/(1-predict(p)), ci(lb ub) > label var odds "odds" > tabdisp alc agegrp, c(odds) > > I can now choose what I would like to graph, but for one > example I will > graph the odds for age group 45-54: > > clear > webuse bdesop > expand freq > tabodds case alc > xi:logit case i.alc agegrp > predictnl odds=predict(p)/(1-predict(p)), ci(lb ub) > label var odds "odds" > tabdisp alc agegrp, c(odds) > > keep if age==3 > #d; > twoway rcap lb ub alc > || connected odds alc, > legend(off) sort > title("Odds for age group 45-54"); > #d cr * * 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/

- Prev by Date:
**RE: st: Re: Thanks - Problems with internet access [was: ... Collapsesyntax error]** - Next by Date:
**st: computing capital stock from a gross investment series** - Previous by thread:
**Re: st: reporting odds for N categories** - Next by thread:
**st: Hurricane & StatCorp?** - Index(es):

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