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]

From |
Richard Williams <richardwilliams.ndu@gmail.com> |

To |
statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu |

Subject |
Re: st: margins option in Stata10? |

Date |
Fri, 12 Aug 2011 09:32:45 -0500 |

At 06:01 AM 8/12/2011, Andreas Fagereng wrote:

Thanks for the help! Hopefully I will be able to run it all on Stata11/12 soon. Andreas

webuse nhanes2f, clear * Replicate AME for black without using margins clonevar xblack = black logit diabetes i.xblack i.female age, nolog margins, dydx(xblack) replace xblack = 0 predict adjpredwhite replace xblack = 1 predict adjpredblack gen meblack = adjpredblack - adjpredwhite sum adjpredwhite adjpredblack meblack if e(sample) After the margins and sum commands you get . margins, dydx(xblack) Average marginal effects Number of obs = 10335 Model VCE : OIM Expression : Pr(diabetes), predict() dy/dx w.r.t. : 1.xblack ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.xblack | .0400922 .0087055 4.61 0.000 .0230297 .0571547 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . sum adjpredwhite adjpredblack meblack if e(sample) Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- adjpredwhite | 10335 .0443248 .0362422 .005399 .1358214 adjpredblack | 10335 .084417 .0663927 .0110063 .2436938 meblack | 10335 .0400922 .0301892 .0056073 .1078724

http://www.stata-press.com/books/musr.html (or at least they did show how in the original version of the book). ------------------------------------------- Richard Williams, Notre Dame Dept of Sociology OFFICE: (574)631-6668, (574)631-6463 HOME: (574)289-5227 EMAIL: Richard.A.Williams.5@ND.Edu WWW: http://www.nd.edu/~rwilliam * * 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/

**References**:**st: margins option in Stata10?***From:*Andreas Fagereng <afagereng@gmail.com>

- Prev by Date:
**Re: st: How do I produce a dataset based on all possible *triplets* of identifiers within each group?** - Next by Date:
**Re: st: what does mean by log likelihood value** - Previous by thread:
**st: margins option in Stata10?** - Next by thread:
**st: multilevel and longitundinal modelling** - Index(es):