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: adjust vs. margins revisited
From 
 
"Michael N. Mitchell" <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: adjust vs. margins revisited 
Date 
 
Fri, 30 Jul 2010 11:32:35 -0700 
Dear All
  As I understand it, in a -logit- model there is a greater preference for computing the 
"Average marginal effect" (AME) than the "Marginal effect at the mean" (MEM). The -adjust- 
command was limited to computing the MEM, but the -margins- command can compute both the 
AME and the MEM. In a linear model, like regress, these two are identical, so there is no 
issue. But, for a model like the logistic model, these yield considerably different 
results, and I think this is a great example of how different the results can be. Let's 
use the original example (which uses the MEM strategy), but I am just going to hold all 
covariates constant at their mean using the MEM method...
************
* MEM METHOD
************
sysuse auto.dta
logistic foreign  price mpg weight
adjust price mpg weight, pr ci
margins, atmeans
. sysuse auto.dta
(1978 Automobile Data)
. logistic foreign  price mpg weight
<output omitted>
. adjust price mpg weight, pr ci
------------------------------------------------------------------------------------------------
     Dependent variable: foreign     Equation: foreign     Command: logistic
 Covariates set to mean: price = 6165.2568, mpg = 21.297297, weight = 3019.4595
------------------------------------------------------------------------------------------------
----------------------------------------------
      All |         pr          lb          ub
----------+-----------------------------------
          |    .041982    [.005215    .268087]
----------------------------------------------
     Key:  pr         =  Probability
           [lb , ub]  =  [95% Confidence Interval]
. margins, atmeans
Adjusted predictions                              Number of obs   =         74
Model VCE    : OIM
Expression   : Pr(foreign), predict()
at           : price           =    6165.257 (mean)
               mpg             =     21.2973 (mean)
               weight          =    3019.459 (mean)
------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   .0419821   .0435708     0.96   0.335    -.0434151    .1273794
------------------------------------------------------------------------------
  Yes, the confidence intervals are different and I am bothered by the -margins- 
confidence interval that tends goes below zero. But, I am even more bothered by the fact 
that the probability of being foreign for an average price, mpg and weight is so far at 
odds with the crude probability of being foreign (which Steve noted was 29.73%).
************
* AME METHOD
************
  Let's try the AME approach using -margins- (which is not available in -adjust-).
. margins
Predictive margins                                Number of obs   =         74
Model VCE    : OIM
Expression   : Pr(foreign), predict()
------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   .2972973   .0316226     9.40   0.000     .2353182    .3592764
------------------------------------------------------------------------------
  This seems more reasonable. And, likewise if we want to hold price at 4000, we can do 
that and get a more reasonable result (compared to something like 0.05 from the MEM approach).
. margins, at(price=4000)
Predictive margins                                Number of obs   =         74
Model VCE    : OIM
Expression   : Pr(foreign), predict()
at           : price           =        4000
------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   .1879927   .0361467     5.20   0.000     .1171464     .258839
------------------------------------------------------------------------------
  I know this sidesteps the issue of the confidence interval question, but at the same 
time this issue appears to go away when using the AME approach.
  I hope this is helpful. I have more about this at http://bit.ly/d5QQKP along with a 
link to a Stata Journal article that discusses this in more detail.
Best regards,
Michael N. Mitchell
Data Management Using Stata      - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week         - http://www.MichaelNormanMitchell.com
On 2010-07-30 10.45 AM, Steve Samuels wrote:
I agree with Richard. There is also another lesson here- for users of
-adjust- and -margins-:
**************************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
*
*   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/