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

# Re: st: adjust vs. margins revisited

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: adjust vs. margins revisited Date Fri, 30 Jul 2010 13:45:42 -0400

```I agree with Richard. There is also another lesson here- for users of

**************************CODE BEGINS**************************
sysuse auto.dta,clear
logistic foreign price mpg weight
adjust price weight mpg, pr ci
tab foreign
**************************CODE BEGINS**************************

Although the crude proportion (mean) of foreign is 0.297, he estimated
probability of "foreign" with the covariates held to their means is
0.042! Estimation at mean values does not always give "typical"
predictions, and, as here, can be completely miselading.

On the other hand, -margins- can recover with a bit of tweaking:
**************************CODE BEGINS**************************
sysuse auto,clear
logistic foreign price mpg weight, robust
predict xb, xb
margins, expression(exp(xb)/(1+exp(xb))) at((means) _all) vce(unconditional)
***************************CODE ENDS***************************

gives a predicted value equal to 0.297.

Steve

--
Steven Samuels
sjsamuels@gmail.com
18 Cantine's Island
Saugerties NY 12477
USA
Voice: 845-246-0774
Fax: 206-202-4783

On Fri, Jul 30, 2010 at 1:33 PM, Richard Williams
<richardwilliams.ndu@gmail.com> wrote:
> At 11:23 AM 7/30/2010, Martin Weiss wrote:
>
>> <>
>>
>> At the German UGM in June, during "Wishes and Grumbles", I requested a
>> table
>> providing a one-to-one mapping between the old -adjust- syntax and the new
>> -margins- syntax to give credence to the assertion in the (version 11.1)
>>
>> "...the margins command can do everything that adjust did and more". So
>> let`s hope it will materialise...
>
> Margins is powerful but complicated. I've heard lots of people say they
> haven't figured it out yet. Even if they would be redundant, I wish the
> -adjust- and -mfx- commands would be updated for Stata 11.  Saying that only
> -margins- is needed is sort of like saying you don't need commands like
> -regress- and -logit- because you've got -glm-. Breaking a complicated
> command into simpler, specialized pieces has a lot of value, in my opinion.
>
>

On Fri, Jul 30, 2010 at 12:07 PM, Tim Wade <wadetj@gmail.com> wrote:
> Hello Statalisters:
>
> Having recently upgradted to v. 11, I have been testing  -margins-
> and, like others have discussed on Statalist, I am trying to reconcile
> some results compared to the old -adjust-
>
> Here is a simplified example
>
>
> sysuse auto.dta
> logistic foreign  price mpg weight
> adjust price=4000 mpg weight, pr ci
> margins, atmeans at(price=4000)
>
> produces the following:
>
>
> . adjust price=4000 mpg weight, pr ci
>
> -----------------------------------------------------------------------------------------------------------------------------------------
>     Dependent variable: foreign     Equation: foreign     Command: logistic
>  Covariates set to mean: mpg = 21.297297, weight = 3019.4595
>  Covariate set to value: price = 4000
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> ----------------------------------------------
>      All |         pr          lb          ub
> ----------+-----------------------------------
>          |    .005861    [.000219    .137016]
> ----------------------------------------------
>     Key:  pr         =  Probability
>           [lb , ub]  =  [95% Confidence Interval]
>
>
> . margins, atmeans at(price=4000)
>
> Adjusted predictions                              Number of obs   =         74
> Model VCE    : OIM
>
> Expression   : Pr(foreign), predict()
> at           : price           =        4000
>               mpg             =     21.2973 (mean)
>               weight          =    3019.459 (mean)
>
> ------------------------------------------------------------------------------
>             |            Delta-method
>             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>       _cons |   .0058613   .0097907     0.60   0.549    -.0133281    .0250508
> ------------------------------------------------------------------------------
>
>
> (http://www.stata.com/statalist/archive/2009-11/msg00199.html where he
> stated:
>
> "The -pr- confidence intervals from -adjust- are computed by transforming the
> end-points of the CI limits from the linear prediction.
>
> -margins- computes the CI limits using the normal approximation is valid."
>
> but here margins produces negative confidence bounds on a probability
> and also produces quite different results from -adjust-, which seems
> to provide reasonable results. It does not seem plausible that both
> results could be considered valid. Any thoughts?
>
> Kind regards, Tim
> *
> *   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/
>

*
*   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/
```