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

From |
jpitblado@stata.com (Jeff Pitblado, StataCorp LP) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: RE: st: RE: Exponentiating bootstrapped coefficients? |

Date |
Wed, 03 Sep 2008 13:12:09 -0500 |

Chelsea Polis <cpolis@jhsph.edu> is using -bootstrap- with -logistic- and asked how to get exponentiated coefficients (odds ratios): > I am doing a logistic regression (xi: logistic hc i.agecat i.educ i.sexpcat > currrltn). When I tried to bootstrap the data (bs "xi: logistic hc i.agecat > i.educ i.sexpcat currrltn" _b, reps(2000) dots), the coefficients are not > exponentiated. > > I tried typing "eform" after the comma (and tried using both logit and > logistic as the main command) but STATA says "option eform not allowed" > (even though eform does show up in the help file). I am using STATA/SE 10.1 > for Windows, on a computer running Vista, if that matters. Can anybody tell > me what I am missing here? I know I could exponentiate everything by hand, > but I can't imagine that people do this each time they bootstrap. Chelsea's original syntax suggests Stata 8, in which -bootstrap- does not support the -eform- option. Nick Cox, Matt Spittal, and Maarten buis each replied with the modern -bootstrap- syntax. Matt noted that using the auto data, xi: bootstrap, reps(2000): logistic foreign i.rep78 price weight produced odds ratios (Note: the -dots- option is now implied). A translation of Chelsea's original call to use -vce(bs)- (the shortcut for -vce(bootstrap)-) xi: logistic hc i.agecat i.educ i.sexpcat currrltn, vce(bs, reps(2000)) should also produce odds ratios. Nick suggested using the -eform- option on the -bootstrap- prefix, but Chelsea noted that this produced the original error message. Maarten noted that > I can reproduce the problem and it looks like a bug to me. However it > is very easy to work around it till someone from StataCorp either tells > us that it isn't a bug but that we are doing something dumb or that > they will fix it: Use -logit- instead of -logistic-. See the example > below: > > *---------------- begin example --------------- > sysuse auto, clear > recode rep78 1/2=3 > > // Works: > xi: bootstrap _b, eform reps(100) dots: /// > logit foreign i.rep78 price > > // Does not work: > xi: bootstrap _b, eform reps(100) dots: /// > logistic foreign i.rep78 price > *------------------ 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 ) We can see that there are several solutions for what Chelsea wants, so I'll just address the only remaining issue. We'll admit that the syntax diagram for -bootstrap- regarding eform options is a little misleading. Here is a quick overview of what is going on. When -bootstrap- is used with an estimation command such as -logistic-, it tries to use the prefixed estimation command to report the results. In this way, -bootstrap- passes all of its display options on to the "results displayer". So while -bootstrap- is willing to see the -eform- option, -logistic- does not allow this display option. Thus we see the error message after -bootstrap-s replication loop. Before -bootstrap- goes into its replication loop, it tries to use the prefixed estimation command to display the results of the original model fit. This test does not employ any display options. While the logic behind the eform options is a little hard to grasp, keep in mind that -bootstrap- is aware of the eform options in addition to -level()-, the other standard display option. In fact, when using -bootstrap- with estimation commands (especially Stata's estimation commands), we recommend you use -vce(bootstrap [, bootstrap_options])-. This should cut down on the confusion. So if you want bootstrap standard errors and odds ratios reported with your logistic model fit, use -logistic- with -vce(bootstrap)-. All display options documented with the estimation command will work so long as you follow the syntax of the command you're using. Thus we can also use -logit- with the -or- option. xi: logit hc i.agecat i.educ i.sexpcat currrltn, or vce(bs, reps(2000)) --Jeff jpitblado@stata.com * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**RE: st: RE: testing -duplicates tag-** - Next by Date:
**Re: st: bootstrap fails with qreg** - Previous by thread:
**Re: st: RE: testing -duplicates tag-** - Next by thread:
**[no subject]** - Index(es):

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