[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 |
st: RE: RE: CIs for the ratio of two adjusted predictions after logistic? |

Date |
Wed, 1 Aug 2007 17:04:53 +0100 |

I think in this the term _b[foreign] should be _b[foreign] * foreign and that _b[foreignXmpg] * mpg should be _b[foreignXmpg] * foreignXmpg Nick n.j.cox@durham.ac.uk Maarten Buis > --- Daniel Waxman wrote: > > I have a logistic model with two terms (one continuous and > one dichotomous) > > and an interaction term, and would like to calculate the > relative risks > > (ratio of predicted probabilities) for the two possible > values of the > > dichotomous variable, at each value of the continuous variable. The > > question is: How do I construct confidence intervals for > this proportion? > > The trick is to do the entire computation in one -predictnl- > command, and > than use the -se()- option, see the example below: > > *---------- begin example ------------------ > sysuse auto, clear > gen good = rep78 >3 if rep78 < . > gen foreignXmpg = foreign*mpg > logit good mpg foreign foreignXmpg > > #delim ; > local xb_for "_b[_cons] + _b[foreign] + > _b[mpg]*mpg + _b[foreignXmpg]*mpg" ; > #delim cr > > local xb_dom "_b[_cons] + _b[mpg]*mpg" > > predictnl rr = invlogit(`xb_for')/ /* > */ invlogit(`xb_dom'), se(se_rr) > > gen ub = rr + 1.96*se_rr > gen lb = rr - 1.96*se_rr > > sort mpg > twoway rarea ub lb mpg, astyle(ci) || /* > */ line rr mpg, clstyle(solid) /* > */ legend(order(2 1) /* > */ label(1 "95% confidence" "interval") /* > */ label(2 "risk ratio")) /* > */ yline(1) > *----------- 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 ) > > Notice that interaction terms in -logit- (or any glm with a > link function other than the identity and I believe the log) > is a tricky issue, see for instance (Allison 1999). > > Allison, Paul D. 1999. "Comparing Logit and Probit > Coefficients Across Groups." Sociological Methods & > Research 28(2):186-208. > * * 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/

**Follow-Ups**:**Re: st: RE: RE: CIs for the ratio of two adjusted predictions after logistic?***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**st: RE: CIs for the ratio of two adjusted predictions after logistic?***From:*"Maarten Buis" <M.Buis@fsw.vu.nl>

- Prev by Date:
**Re: st: Using 2 stage Heckmen Sample Selection with Lags in STATA** - Next by Date:
**RE: st: RE: RE: CIs for the ratio of two adjusted predictions after logistic?** - Previous by thread:
**st: RE: CIs for the ratio of two adjusted predictions after logistic?** - Next by thread:
**Re: st: RE: RE: CIs for the ratio of two adjusted predictions after logistic?** - Index(es):

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