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]

st: no difference between results obtained from -margins- and -margins, atmeans-


From   "Burgard, Sarah" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: no difference between results obtained from -margins- and -margins, atmeans-
Date   Thu, 12 Apr 2012 14:39:56 +0000

Dear colleagues,
I have what is probably a simple question. I am exploring the implications of obtaining predictions using -margins- versus -margins, atmeans-  for simple weighted OLS regressions. 

My substantive goal is to obtain the "adjusted" or predicted gender difference in minutes of sleep across age categories, adjusting for a large number of covariates that predict sleep and including interactions between female gender and covariates. I believe that what I want is obtained by specifying -margins female, over(agecat)- after running the regression model.

However, Stata 12 is returning the same predicted values for both -margins female, over(agecat)- and -margins female, over(agecat) atmeans-

This happens when using a simpler model with the "auto" data that we are all familiar with as well - please see below. Does anyone see what I am doing wrong (note that I have the same problem even if I restimate the same model and then request -margins, atmeans-) 
thank you,
Sarah Burgard

. sysuse auto
(1978 Automobile Data)
. regress mpg turn i.foreign
      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  2,    71) =   38.97
       Model |  1278.68109     2  639.340545           Prob > F      =  0.0000
    Residual |  1164.77837    71  16.4053292           R-squared     =  0.5233
-------------+------------------------------           Adj R-squared =  0.5099
       Total |  2443.45946    73  33.4720474           Root MSE      =  4.0503
------------------------------------------------------------------------------
         mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        turn |  -1.029205    .138914    -7.41   0.000    -1.306192   -.7522186
   1.foreign |  -1.263614   1.328003    -0.95   0.345    -3.911577    1.384349
       _cons |   62.47956   5.784252    10.80   0.000     50.94609    74.01303
------------------------------------------------------------------------------
. margins foreign

Predictive margins                                Number of obs   =         74
Model VCE    : OLS
Expression   : Linear prediction, predict()
------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     foreign |
          0  |   21.67297   .6144672    35.27   0.000     20.46863     22.8773
          1  |   20.40935   1.045246    19.53   0.000     18.36071      22.458
------------------------------------------------------------------------------
. margins foreign, atmeans

Adjusted predictions                              Number of obs   =         74
Model VCE    : OLS
Expression   : Linear prediction, predict()
at           : turn            =    39.64865 (mean)
               0.foreign       =    .7027027 (mean)
               1.foreign       =    .2972973 (mean)
------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     foreign |
          0  |   21.67297   .6144673    35.27   0.000     20.46863     22.8773
          1  |   20.40935   1.045246    19.53   0.000     18.36071      22.458
------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sarah Burgard
Associate Professor 
Sociology | Epidemiology | Population Studies Center
University of Michigan
http://sarahburgard.com/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index