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   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Confidence intervals around ratios/differences of predicted probabilities
Date   Mon, 12 Aug 2013 12:25:38 +0200

On Mon, Aug 12, 2013 at 11:52 AM, P.Praeg  wrote:
> 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?


*------------------ begin example ------------------
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

// predicted probabilities

margins i.groups

// differences in predicted probabilities

margins r.groups

// ratios of predicted probabilities

margins i.group, ///
   expression(invlogit(xb())/ ///
   invlogit(xb()-_b[1.groups]*1.groups - _b[2.groups]*2.groups) )

*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )


Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   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