Announcement

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

  • margins after mepoisson

    Dear all,
    I am using mepoisson in Stata 14.2. I would like to use the margins command to predict prevalence of my outcome variable at certain levels of my other independent variables. My outcome variable "outcome" and my main predictor "predictor1" are binary, "reg" is a categorical variable with three levels (1,5,6). The data is clustered within "country" and "ID".

    Code:
      mepoisson outcome i.predictor1 i.reg || country: || ID:, irr vce(robust)
    
    Fitting fixed-effects model:
    
    Iteration 0:   log likelihood = -2810.5335  
    Iteration 1:   log likelihood = -1568.9639  
    Iteration 2:   log likelihood = -1556.0247  
    Iteration 3:   log likelihood = -1555.9226  
    Iteration 4:   log likelihood = -1555.9226  
    
    Refining starting values:
    
    Grid node 0:   log likelihood = -1577.2488
    
    Fitting full model:
    
    Iteration 0:   log pseudolikelihood = -1577.2488  (not concave)
    Iteration 1:   log pseudolikelihood = -1572.9681  (not concave)
    Iteration 2:   log pseudolikelihood = -1569.4319  
    Iteration 3:   log pseudolikelihood = -1547.3335  
    Iteration 4:   log pseudolikelihood = -1546.5528  
    Iteration 5:   log pseudolikelihood = -1546.5161  
    Iteration 6:   log pseudolikelihood = -1546.5157  
    Iteration 7:   log pseudolikelihood = -1546.5157  
    
    Mixed-effects Poisson regression                Number of obs     =      3,508
    
    -------------------------------------------------------------
                    |     No. of       Observations per Group
     Group Variable |     Groups    Minimum    Average    Maximum
    ----------------+--------------------------------------------
            country |          7         39      501.1      1,690
                 ID |      1,620          1        2.2         11
    -------------------------------------------------------------
    
    Integration method: mvaghermite                 Integration pts.  =          7
    
                                                    Wald chi2(3)      =    1413.67
    Log pseudolikelihood = -1546.5157               Prob > chi2       =     0.0000
                                    (Std. Err. adjusted for 7 clusters in country)
    ------------------------------------------------------------------------------
                 |               Robust
         outcome |        IRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
                 |
      predictor1 |
            yes  |   2.157889   .0978981    16.95   0.000     1.974295    2.358555
                 |
             reg |
              5  |   2.259887   .6934752     2.66   0.008     1.238468    4.123716
              6  |   1.217198   .3951846     0.61   0.545      .644175    2.299952
                 |
           _cons |   .0611361   .0185108    -9.23   0.000     .0337731    .1106687
    -------------+----------------------------------------------------------------
    country      |
       var(_cons)|   .1203065   .0843019                       .030467    .4750597
    -------------+----------------------------------------------------------------
    country>ID   |
       var(_cons)|   .1400121   .1211855                      .0256696    .7636791
    ------------------------------------------------------------------------------
    
    . margins predictor1, at(reg=(1 5 6)) vsquish
    
    Adjusted predictions                            Number of obs     =      3,508
    Model VCE    : Robust
    
    Expression   : Marginal predicted mean, predict()
    1._at        : reg             =           1
    2._at        : reg             =           5
    3._at        : reg             =           6
    
    --------------------------------------------------------------------------------
                   |            Delta-method
                   |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    _at#predictor1 |
             1#no  |   .0696347   .0188608     3.69   0.000     .0326682    .1066011
            1#yes  |   .1502638   .0458866     3.27   0.001     .0603277       .2402
             2#no  |   .1573665    .010414    15.11   0.000     .1369554    .1777775
            2#yes  |   .3395793   .0159296    21.32   0.000     .3083578    .3708008
             3#no  |   .0847592   .0056107    15.11   0.000     .0737625    .0957559
            3#yes  |   .1829009   .0075109    24.35   0.000     .1681798    .1976219
    --------------------------------------------------------------------------------
    
    .
    My question is why the marginal predicted mean at 1#no (reg==1 & predictor1==0) does not equal the constant ( .0611361 versus .0696347). If I run a model without random effects but with the same fixed effects covariates (posted below), the marginal predicted mean at 1#no equals the constant (.0576345). Is it appropriate to use margins to get adjusted prevalences after multilevel poisson regression?


    Code:
      poisson outcome i.predictor1 i.reg, irr
    
    Iteration 0:   log likelihood = -1555.9314  
    Iteration 1:   log likelihood = -1555.9226  
    Iteration 2:   log likelihood = -1555.9226  
    
    Poisson regression                              Number of obs     =      3,508
                                                    LR chi2(3)        =     185.95
                                                    Prob > chi2       =     0.0000
    Log likelihood = -1555.9226                     Pseudo R2         =     0.0564
    
    ------------------------------------------------------------------------------
         outcome |        IRR   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
      predictor1 |
            yes  |   2.100162   .1894557     8.23   0.000      1.75981    2.506338
                 |
             reg |
              5  |   2.740937    .304444     9.08   0.000     2.204721    3.407568
              6  |   1.431582   .2184172     2.35   0.019     1.061569    1.930565
                 |
           _cons |   .0576345   .0063382   -25.95   0.000     .0464595    .0714975
    ------------------------------------------------------------------------------
    
    . margins predictor1, at(reg=(1 5 6)) vsquish
    
    Adjusted predictions                            Number of obs     =      3,508
    Model VCE    : OIM
    
    Expression   : Predicted number of events, predict()
    1._at        : reg             =           1
    2._at        : reg             =           5
    3._at        : reg             =           6
    
    --------------------------------------------------------------------------------
                   |            Delta-method
                   |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    _at#predictor1 |
             1#no  |   .0576345   .0063382     9.09   0.000      .045212    .0700571
            1#yes  |   .1210418   .0130356     9.29   0.000     .0954926    .1465911
             2#no  |   .1579727   .0119175    13.26   0.000     .1346147    .1813306
            2#yes  |   .3317681   .0197923    16.76   0.000     .2929758    .3705604
             3#no  |   .0825086   .0115378     7.15   0.000     .0598949    .1051223
            3#yes  |   .1732813   .0189125     9.16   0.000     .1362135    .2103492
    --------------------------------------------------------------------------------
    Thank you very much in advance.
    Jennyfer

  • #2
    It is not surprising that in the multi-level model the predicted margin at 1#no is different from the constant term. -margins- is (appropriately) adjusting for the distribution of the random effects in the estimation sample. The one-level -poisson- model doesn't do that.

    Now, you may be thinking that the average random effect should be zero, so why does it move the margin away from the constant. But remember this is a non-linear model (log link function), so that an individual with a random effect of, say, -.5 does not "cancel out" an individual with a random effect of +.5.

    Comment


    • #3
      Dear Clyde,
      Thank you very much. This is very clear and helpful. Do the predicted margin at 1#no and the constant term from the multilevel model have a different interpretation (in my understanding they are both adjusted prevalences)?
      Thank you very much again!
      Jennyfer

      Comment


      • #4
        Yes. The constant term could be interpreted as being a prevalence adjusted to the fixed-effect covariate distribution and with all random effects constrained to zero. The -margins- output would be a prevalence adjusted to both the fixed and random effect distributions.

        Comment

        Working...
        X