Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Discrepancy in in estimates using over() and at() in margins.

    Hi Everyone,

    I'm running a survey-weighted regression model with marginal means estimates. I noticed that over() and at() do not produce equivalent results and I was unsure why. Here's the relevant portion of the regression output. There were no interaction terms and there were a dozen covariates.
    Code:
           relid |
    
    ------------------------------------------------------------------------------
                 |             Linearized
              dv |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    
           relid |
      Agnostics  |  -.2154432   .0940226    -2.29   0.022    -.3998531   -.0310333
     OtherNones  |   -.244422   .1706986    -1.43   0.152    -.5792192    .0903751
           NIPs  |  -.2634163   .0966674    -2.72   0.006    -.4530134   -.0738191
    Protestants  |  -.5831272   .0987427    -5.91   0.000    -.7767946   -.3894598
      Catholics  |  -.4672434   .0953257    -4.90   0.000    -.6542089   -.2802779
     Christians  |  -.3771565    .182936    -2.06   0.039    -.7359551   -.0183579
    When I ran the margins command initially it was:

    Code:
    margins, at(relid = (0 1 2 3 4 5 6)) atmeans pwcomp(pv)
    -----------------------------------------------------
                 |            Delta-method    Unadjusted
                 |   Contrast   Std. Err.      t    P>|t|
    -------------+---------------------------------------
             _at |
         2 vs 1  |  -.2154432   .0940226    -2.29   0.022
         3 vs 1  |   -.244422   .1706986    -1.43   0.152
         4 vs 1  |  -.2634163   .0966674    -2.72   0.006
         5 vs 1  |  -.5831272   .0987427    -5.91   0.000
         6 vs 1  |  -.4672434   .0953257    -4.90   0.000
    By happenstance I happened to enter a different margins specification the next time I ran the model, and got different results

    Code:
    margins, over(relid) atmeans pwcomp(pv)
    -------------------------------------------------------------------
                               |            Delta-method    Unadjusted
                               |   Contrast   Std. Err.      t    P>|t|
    ---------------------------+---------------------------------------
                         relid |
        Agnostics vs Atheists  |  -.2330303   .0940864    -2.48   0.013
       OtherNones vs Atheists  |  -.5501877   .1735495    -3.17   0.002
             NIPs vs Atheists  |  -.5491664   .0929277    -5.91   0.000
      Protestants vs Atheists  |  -1.014815   .0815914   -12.44   0.000
        Catholics vs Atheists  |  -.8043829   .0848022    -9.49   0.000
       Christians vs Atheists  |  -.8228742   .1765394    -4.66   0.000
    I was curious why these did not produce the same estimates. relid was not interacted with anything and both models used the <atmeans> option. Could someone clarify what I am missing here?

    Thanks!

    David.

  • #2
    Also posted at

    https://www.statalist.org/forums/for...argins-command

    with a subsequent response.

    Comment

    Working...
    X