Announcement

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

  • Calculating Marginal Effects

    Dear all,

    I have had some trouble calculating one of the marginal effects of my regression. I am running the following regression:
    Code:
    xtreg manemp lnpop lnpop2 lngdppc lngdppc2 _2000s _2010s 1._2000s#1.la 1._2010s#1.la, fe
    My main variables of interest are _2000s and _2010s, which are two decadal dummies and the interaction term between the indicator variable la, which is an indicator variable for a specific region, Latin America, and the two decadal dummies. I do this in order to estimate how much of the period dummies vary by region (in this case Latin America). My results are as follows:

    Code:
    esttab, drop(_cons lnpop lnpop2 lngdppc lngdppc2)
    
    ----------------------------
                          (1)  
                       manemp  
    ----------------------------
    _2000s           -0.00286  
                      (-1.51)  
    
    _2010s            0.00128  
                       (0.42)  
    
    1._2000s#1~a     -0.00849**
                      (-2.68)  
    
    1._2010s#1~a      -0.0132***
                      (-3.97)  
    ----------------------------
    N                    1479  
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    I am quite happy with these results, but now I am trying to calculate the marginal effect of the specific region, Latin America, compared to the full sample. This is in fact pretty simple, as I can just add the coefficients for_2000s (-0.00286) and for _2000s X la (-0.00849) which should be equal to -0,01176. I want to compute the marginal effects for both decadal dummies, specifically when my indicator variable, in this case, la, is equal to 1. I want to compute the marginal effects using:
    Code:
    margins dydx(varlist)
    I have tried to get the results I wanted using the different options in the stata manual (https://www.stata.com/manuals13/rmargins.pdf) with trial and error, but I have not been able to get the results I want just yet. Does anyone have some advice perhaps?

    A second question, perhaps unrelated, I am dealing with panel data on 51 countries over 29 years. I want to run the specified regressions and obtain the marginal effects for 7 different regions (Latin America being one) and for 51 different countries. So this means I want to run 58 regressions. Is there a somewhat efficient way to do this?

    Thank you in advance.

    Best,

    Hylke Dijkstra

  • #2
    I have been able to obtain some of the results that I want by using:

    Code:
    xtreg manemp lnpop lnpop2 lngdppc lngdppc2 _2000s _2010s 1._2000s#1.la 1._2010s#1.la, fe
    mfx, dydx
    which gives me:
    Code:
    Marginal effects after xtreg
          y  = Linear prediction (predict)
             =  .11394801
    ------------------------------------------------------------------------------
    variable |      dy/dx    Std. err.     z    P>|z|  [    95% C.I.   ]      X
    ---------+--------------------------------------------------------------------
       lnpop |  -.2077072      .04591   -4.52   0.000  -.297689 -.117725   17.0983
      lnpop2 |   .0063001      .00138    4.55   0.000   .003588  .009012   294.518
     lngdppc |   .3723604      .01862   20.00   0.000   .335861   .40886   8.60209
    lngdppc2 |   -.022366      .00108  -20.72   0.000  -.024481  -.02025   75.1394
      _2000s*|  -.0113541      .00311   -3.66   0.000  -.017441 -.005267   .344828
      _2010s*|  -.0119193      .00381   -3.12   0.002  -.019396 -.004443   .310345
    ------------------------------------------------------------------------------
    (*) dy/dx is for discrete change of dummy variable from 0 to 1
    I am quite happy with this result, except for the computation of the standard error. So, I would like to obtain the same results using:

    Code:
    margins
    I have attempted to do run the same regression using a different interaction for a different region, in this case, Advanced Asia. The results are as follows:

    Code:
    xtreg manemp lnpop lnpop2 lngdppc lngdppc2 _2000s _2010s 1._2000s#1.aa 1._2010s#1.aa, fe
    mfx, dydx
    Code:
    esttab, drop(_cons lnpop lnpop2 lngdppc lngdppc2)
    
    ----------------------------
                          (1)   
                       manemp   
    ----------------------------
    _2000s           -0.00114   
                      (-0.63)   
    
    _2010s            0.00226   
                       (0.78)   
    
    1._2000s#1~a      -0.0295***
                      (-7.70)   
    
    1._2010s#1~a      -0.0374***
                      (-8.58)   
    ----------------------------
    N                    1479   
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    When I run the same command as before:

    Code:
    mfx, dydx
    It gives me the following results:

    Code:
    Marginal effects after xtreg
          y  = Linear prediction (predict)
             =  .11527156
    ------------------------------------------------------------------------------
    variable |      dy/dx    Std. err.     z    P>|z|  [    95% C.I.   ]      X
    ---------+--------------------------------------------------------------------
       lnpop |  -.1592691      .04503   -3.54   0.000  -.247528  -.07101   17.0983
      lnpop2 |   .0047516      .00136    3.50   0.000   .002088  .007415   294.518
     lngdppc |   .3113827       .0198   15.72   0.000   .272567  .350199   8.60209
    lngdppc2 |  -.0185762      .00116  -16.04   0.000  -.020846 -.016306   75.1394
      _2000s*|  -.0011438       .0018   -0.63   0.526  -.004676  .002389   .344828
      _2010s*|    .002264       .0029    0.78   0.434  -.003412   .00794   .310345
    ------------------------------------------------------------------------------
    (*) dy/dx is for discrete change of dummy variable from 0 to 1
    This is confusing to me because it seems to report the coefficients for just the decadal dummies..

    Does anyone have some thoughts on this (preferably using the margins command)?



    Comment


    • #3
      Please note our policy on cross-posting in the FAQ.

      This was cross posted to Reddit at https://www.reddit.com/r/stata/comme...ginal_effects/

      Comment

      Working...
      X