Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Confidence intervals around ratios/differences of predicted probabilities


From   Tim Wade <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Confidence intervals around ratios/differences of predicted probabilities
Date   Mon, 12 Aug 2013 09:12:40 -0400

provided, you can alternatively use lincom and nlcom after margins
like this:

sysuse auto, clear
gen groups = irecode(mpg, 17, 23, 42)
logistic foreign i.groups
margins i.groups, coeflegend post
lincom 2.groups-0bn.groups
nlcom _b[2.groups]/_b[0bn.groups]


. lincom 2.groups-0bn.groups

 ( 1)  - 0bn.groups + 2.groups = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .3550725   .1362537     2.61   0.009     .0880201    .6221248
------------------------------------------------------------------------------

. nlcom _b[2.groups]/_b[0bn.groups]

       _nl_1:  _b[2.groups]/_b[0bn.groups]

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _nl_1 |   3.130435   1.764279     1.77   0.076    -.3274893    6.588359
------------------------------------------------------------------------------


Tim


On Mon, Aug 12, 2013 at 5:52 AM, P.Praeg <[email protected]> wrote:
> Dear all:
>
> I would like to calculate confidence intervals around ratios and differences of predicted probabilities as obtained from logistic regression models. Is there a straightforward way to calculate these in Stata? Specifically, I am doing the following:
>
> sysuse auto, clear
>
> // I have a logistic regression model with a binary outcome (foreign),
> // a set of dummies which denote several groups of interest (i.groups),
> // and a vector of controls (not shown here to make things easier):
>
> gen groups = irecode(mpg, 17, 23, 42)  // Creates three groups based on mpg
>
> logistic foreign i.groups
>
> // With the -margins- command, I get predicted probabilities of
> // being foreign for each of my groups:
>
> margins i.groups, coeflegend
>
> // What I am interested in then is the difference and the ratio of
> // some of these predicted probabilities:
>
> matrix pred_prob = r(table)
>
>   // Difference
> di pred_prob[1,3] - pred_prob[1,1]
>
>   // Ratio
> di pred_prob[1,3] / pred_prob[1,1]
>
> This now gives me point estimates for the difference and ratio of the predicted probabilities.
>
> My question now is: Is there any straightforward way to obtain confidence intervals around these point estimates?
>
> Thanks for your consideration!
> Patrick
>
> --
> Patrick Präg
> ICS/Department of Sociology
> Faculty of Social and Behavioral Sciences
> University of Groningen
> Grote Rozenstraat 31
> 9712 TG Groningen, The Netherlands
>
> Tel: +31 (0)50 363 7620
> Email: [email protected]
>
> http://www.rug.nl/staff/p.praeg
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index