Announcement

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

  • Difference between "within" and "subpop" options in margins contrast after svy:logit

    Hello:

    I get different results using within and subpop specifications in the following case (YEAR is 2011-2017 but I show you the issue only for 2011):

    Code:
    . svy linearized, subpop(if $subpopulation) : logit $depvar YEAR##COHORT_10
    (output ommited)
    . margins gw.COHORT_10, within(2011.YEAR) contrast(nowald) subpop(if $subpopulation) vce(unconditional) mcompare(bonferroni adjustall)
    
    Contrasts of adjusted predictions
    
    Number of strata   =       628                  Subpop. no. obs   =    112,351
    Number of PSUs     =   115,246                  Subpop. size      =          .
                                                    Design df         =    114,618
    
    Expression   : Pr(INT_3MESES), predict()
    
    -----------------------------
                   |    Number of
                   |  Comparisons
    ---------------+-------------
    All            |            7
    -----------------------------
    
    ------------------------------------------------------------------------------
                                 |             Linearized          Bonferroni
                                 |   Contrast   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
                  COHORT_10@YEAR |
    (1935 o antes vs mean) 2011  |  -.5760896   .0066247      -.593911   -.5582683
       (1936-1945 vs mean) 2011  |  -.4712887   .0099504     -.4980569   -.4445205
       (1946-1955 vs mean) 2011  |  -.2590204   .0111165     -.2889254   -.2291153
       (1956-1965 vs mean) 2011  |   .0014224   .0103063     -.0263032    .0291479
       (1966-1975 vs mean) 2011  |   .1494979   .0089336      .1254651    .1735308
       (1976-1985 vs mean) 2011  |   .2427616   .0088764      .2188827    .2666405
       (1986-1995 vs mean) 2011  |   .3281684   .0078526      .3070436    .3492933
    ------------------------------------------------------------------------------
    
    . margins gw.COHORT_10, contrast(nowald) subpop(if YEAR==2011 & $subpopulation) vce(unconditional) mcompare(bonferroni adjustall)
    
    Contrasts of predictive margins
    
    Number of strata   =       628                  Subpop. no. obs   =     18,801
    Number of PSUs     =   115,246                  Subpop. size      =          .
                                                    Design df         =    114,618
    
    Expression   : Pr(INT_3MESES), predict()
    
    ---------------------------
                 |    Number of
                 |  Comparisons
    -------------+-------------
    All          |            7
    ---------------------------
    
    -------------------------------------------------------------------------
                            |             Linearized          Bonferroni
                            |   Contrast   Std. Err.     [95% Conf. Interval]
    ------------------------+------------------------------------------------
                  COHORT_10 |
    (1935 o antes vs mean)  |  -.5640506    .006508     -.5815581   -.5465431
       (1936-1945 vs mean)  |  -.4592496   .0099134     -.4859184   -.4325809
       (1946-1955 vs mean)  |  -.2469813   .0111167     -.2768869   -.2170758
       (1956-1965 vs mean)  |   .0134614   .0103267      -.014319    .0412418
       (1966-1975 vs mean)  |   .1615369   .0089557      .1374446    .1856293
       (1976-1985 vs mean)  |   .2548007   .0088913      .2308817    .2787196
       (1986-1995 vs mean)  |   .3402075   .0078493      .3190917    .3613232
    -------------------------------------------------------------------------
    As you can see, contrast coefficient are not exactly the same in both examples, although marginal effects between COHORT_10 categories are always the same. I think this is because the background assumptions about the mean to compare with in each case; I am more interested in the second form derived from the "subpop option".

    I would like to get the contrasts in the form of the "subpop version" for each year. Of course, I can do it with the "within option", writing
    Code:
    within(YEAR)
    instead of
    Code:
    within(2011.YEAR)
    , but not with the "subpop option". Again, the question: Is it possible to get the contrasts in the "subpop way" for all the years in just one command? [My goal is to easily plot the contrasts for all the cohorts across years, connecting the dots of the same cohort]

    Thank you very much.
Working...
X