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

From |
Philip Ender <ender97@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: -margins- vs -adjust- |

Date |
Wed, 4 Nov 2009 10:52:23 -0800 |

On 4nov2009 Jay Verkuilen wrote: >-adjust- had some nice features that -margins- seems to lack, or else maybe I just don't properly understand. For instance, -adjust- used to be >able to take a variable that wasn't in the model as an argument and generate predictions, etc., for it. > >Example: > >Run a logit model over a continuous covariate, then run -adjust- over a binned version of that covariate to make a nice table of predicted >probabilities. > >Let me see if I can make an example: > >. sysuse auto >. gen mpg2 = 10*trunc(mpg/10)+5 >. logit foreign mpg >. adjust, by(mpg2) pr ci vertical > >Which gives: > >Dependent variable: foreign Command: logit >Variable left as is: mpg > >mpg2 pr lb ub > >15 .152759 [.074742 .286956] >25 .353318 [.238384 .488149] >35 .692834 [.411283 .879263] >45 .89765 [.545156 .984657] > >Key: pr = Probability >[lb , ub] = [95% Confidence Interval] > > >In short, one of the things I liked about -adjust- was the fact that it was a little bit "hackable." :) I simply haven't had to do any kind of serious >analysis using Stata 11 recently (too much other BS to deal with, committees, etc., plus the fact that some RL things intervened) so maybe >there is a way and I'm simply not seeing it. The following -margins- commands produce very close point estimates but somewhat different confidence intervals: . logit foreign mpg . margins if mpg2==15 Predictive margins Number of obs = 35 Model VCE : OIM Expression : Pr(foreign), predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .1576242 .0514502 3.06 0.002 .0567838 .2584647 . margins if mpg2==25 Predictive margins Number of obs = 32 Model VCE : OIM Expression : Pr(foreign), predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .3580884 .063645 5.63 0.000 .2333465 .4828303 And so on for . margins if mpg2==35 . margins if mpg2==45 It will be interesting to see what Stata has to say about these two approaches. -- Phil Ender Statistical Consulting Group UCLA Academic Technology Services * * 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/

**Follow-Ups**:**RE: st: RE: -margins- vs -adjust-***From:*"Verkuilen, Jay" <JVerkuilen@gc.cuny.edu>

- Prev by Date:
**st: t-test comparing the means of two samples in imputed datasets** - Next by Date:
**Re: st: unit-root tests: xt-fisher, Hadri, ipshin** - Previous by thread:
**st: t-test comparing the means of two samples in imputed datasets** - Next by thread:
**RE: st: RE: -margins- vs -adjust-** - Index(es):

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