2
$\begingroup$

My understanding of margins results is that they should not be sensitive to the base period chosen for a categorical time variable. However, I find that they are.

use http://www.stata-press.com/data/r12/nlswork.dta, clear
set seed 1234
gen rndm=uniform()
bys idcode: egen x=mean(rndm)
gen treated_group=(x<0.4)
drop rndm x
qui areg ln_wage i.treated_group##ib68.year, absorb(idcode)
margins year, at (treated_group=(0 1)) noestimcheck

Adjusted predictions                            Number of obs     =     28,534
Model VCE    : OLS

Expression   : Linear prediction, predict()

1._at        : treated_group   =           0

2._at        : treated_group   =           1

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    _at#year |
       1 68  |   1.444114   .0092306   156.45   0.000     1.426021    1.462206
       1 69  |   1.536417   .0110225   139.39   0.000     1.514812    1.558022
       1 70  |   1.519892   .0096172   158.04   0.000     1.501042    1.538742
       1 71  |   1.569712   .0092502   169.70   0.000     1.551581    1.587843
       1 72  |   1.580554   .0095499   165.50   0.000     1.561835    1.599272
       1 73  |   1.599594   .0089301   179.12   0.000     1.582091    1.617098
       1 75  |   1.612995   .0086646   186.16   0.000     1.596012    1.629978
       1 77  |   1.668559   .0086132   193.72   0.000     1.651676    1.685441
       1 78  |   1.703676   .0089237   190.92   0.000     1.686185    1.721167
       1 80  |   1.716041   .0091365   187.82   0.000     1.698132    1.733949
       1 82  |   1.733376   .0087527   198.04   0.000      1.71622    1.750532
       1 83  |   1.757594   .0089667   196.01   0.000     1.740018    1.775169
       1 85  |   1.806221   .0088706   203.62   0.000     1.788834    1.823608
       1 87  |   1.824522   .0087495   208.53   0.000     1.807372    1.841671
       1 88  |   1.879086   .0087315   215.21   0.000     1.861972      1.8962
       2 68  |   1.444114   .0092306   156.45   0.000     1.426021    1.462206
       2 69  |   1.505828   .0289567    52.00   0.000     1.449071    1.562585
       2 70  |   1.504917   .0267331    56.29   0.000     1.452518    1.557315
       2 71  |    1.56406   .0266853    58.61   0.000     1.511755    1.616365
       2 72  |   1.579169   .0277075    56.99   0.000     1.524861    1.633477
       2 73  |   1.573991   .0269577    58.39   0.000     1.521152    1.626829
       2 75  |    1.59415   .0267183    59.67   0.000     1.541781     1.64652
       2 77  |   1.649944   .0268489    61.45   0.000     1.597319     1.70257
       2 78  |   1.688432   .0277801    60.78   0.000     1.633981    1.742882
       2 80  |   1.673237   .0282171    59.30   0.000      1.61793    1.728545
       2 82  |   1.708132   .0273014    62.57   0.000      1.65462    1.761645
       2 83  |   1.733978   .0277659    62.45   0.000     1.679555    1.788401
       2 85  |    1.79532    .027219    65.96   0.000     1.741969    1.848671
       2 87  |   1.805997   .0272753    66.21   0.000     1.752536    1.859458
       2 88  |   1.882125   .0271057    69.44   0.000     1.828996    1.935254
------------------------------------------------------------------------------

Note: I am using base year 68. The average predicted value for the treated group at time 88 is 1.879.

Now, change nothing but the base year, to 69:

qui areg ln_wage i.treated_group##ib69.year, absorb(idcode)
margins year, at (treated_group=(0 1)) noestimcheck

Adjusted predictions                            Number of obs     =     28,534
Model VCE    : OLS

Expression   : Linear prediction, predict()

1._at        : treated_group   =           0

2._at        : treated_group   =           1

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    _at#year |
       1 68  |    1.43873   .0109392   131.52   0.000     1.417288    1.460171
       1 69  |   1.531033   .0093871   163.10   0.000     1.512634    1.549433
       1 70  |   1.514508   .0096481   156.97   0.000     1.495597    1.533419
       1 71  |   1.564328   .0092902   168.38   0.000     1.546119    1.582538
       1 72  |    1.57517   .0095905   164.24   0.000     1.556372    1.593968
       1 73  |   1.594211   .0089738   177.65   0.000     1.576621      1.6118
       1 75  |   1.607611   .0087209   184.34   0.000     1.590518    1.624705
       1 77  |   1.663175   .0086695   191.84   0.000     1.646182    1.680168
       1 78  |   1.698292   .0089774   189.17   0.000     1.680696    1.715888
       1 80  |   1.710657   .0091904   186.14   0.000     1.692643    1.728671
       1 82  |   1.727992   .0088108   196.12   0.000     1.710723    1.745262
       1 83  |    1.75221    .009026   194.13   0.000     1.734518    1.769901
       1 85  |   1.800837   .0089313   201.63   0.000     1.783331    1.818343
       1 87  |   1.819138   .0088103   206.48   0.000      1.80187    1.836407
       1 88  |   1.873702   .0087973   212.98   0.000     1.856459    1.890945
       2 68  |   1.469319   .0288182    50.99   0.000     1.412834    1.525805
       2 69  |   1.531033   .0093871   163.10   0.000     1.512634    1.549433
       2 70  |   1.530122   .0268025    57.09   0.000     1.477588    1.582657
       2 71  |   1.589266   .0268825    59.12   0.000     1.536575    1.641957
       2 72  |   1.604375   .0279935    57.31   0.000     1.549506    1.659244
       2 73  |   1.599196   .0273319    58.51   0.000     1.545624    1.652769
       2 75  |   1.619356   .0271298    59.69   0.000      1.56618    1.672532
       2 77  |    1.67515   .0272555    61.46   0.000     1.621727    1.728572
       2 78  |   1.713637   .0281276    60.92   0.000     1.658505    1.768769
       2 80  |   1.698443   .0285348    59.52   0.000     1.642513    1.754373
       2 82  |   1.733338   .0276316    62.73   0.000     1.679178    1.787497
       2 83  |   1.759184   .0280852    62.64   0.000     1.704135    1.814232
       2 85  |   1.820525   .0275764    66.02   0.000     1.766474    1.874577
       2 87  |   1.831203    .027657    66.21   0.000     1.776993    1.885412
       2 88  |   1.907331   .0274802    69.41   0.000     1.853468    1.961194
------------------------------------------------------------------------------

Now, instead of 1.879, the average predicted value for the treated group in time 88 is 1.907.

Given that the predicted values are sensitive to a change in the base time period, how can the results from margins be interpreted?

$\endgroup$
2
  • $\begingroup$ What is your question? $\endgroup$
    – Brennan
    Apr 19 '20 at 7:23
  • 2
    $\begingroup$ Hi @Brennan, I've edited the post to clarify the question and added reproducible code. $\endgroup$
    – sommertime
    Apr 19 '20 at 22:32
1
$\begingroup$

The best practice would be to add a reproducible example that improves the understanding of your question.

Let me consider an example where year is a categorical (or factor) variable from 68 to 88. I prefix the variable with ib68. to specify indicators for each level of the variable where year=68 became the base level. The results would be compared to this base level. Using Stata,

use http://www.stata-press.com/data/r12/nlswork.dta, clear
regress ln_w ib68.year

I get this result

      Source |       SS           df       MS      Number of obs   =    28,534
-------------+----------------------------------   F(14, 28519)    =    160.14
       Model |  475.336723        14  33.9526231   Prob > F        =    0.0000
    Residual |  6046.54716    28,519  .212018204   R-squared       =    0.0729
-------------+----------------------------------   Adj R-squared   =    0.0724
       Total |  6521.88388    28,533  .228573367   Root MSE        =    .46045

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        year |
         69  |   .0896719   .0180634     4.96   0.000     .0542667    .1250771
         70  |   .0656875   .0167316     3.93   0.000     .0328927    .0984823
         71  |   .1054983   .0163932     6.44   0.000     .0733669    .1376298
         72  |   .1259221   .0167161     7.53   0.000     .0931578    .1586864
         73  |   .1370875   .0161623     8.48   0.000     .1054086    .1687664
         75  |    .138505    .015913     8.70   0.000     .1073148    .1696952
         77  |   .2174525   .0158699    13.70   0.000     .1863467    .2485583
         78  |   .2749292    .016191    16.98   0.000     .2431941    .3066642
         80  |   .2884127   .0164008    17.59   0.000     .2562664     .320559
         82  |   .2850714   .0159963    17.82   0.000     .2537179     .316425
         83  |   .3269154   .0161523    20.24   0.000     .2952561    .3585747
         85  |   .3904817   .0159963    24.41   0.000     .3591282    .4218353
         87  |   .4006089   .0158799    25.23   0.000     .3694837    .4317342
         88  |   .4385766   .0157325    27.88   0.000       .40774    .4694131
             |
       _cons |    1.44136   .0124175   116.07   0.000     1.417022    1.465699
------------------------------------------------------------------------------

Wages are increasing over time.

If I change the base group such as I prefix the variable with ib88., year=88 became the base level and the estimates change but the story is the same. On average, wages are higher in 88.

reg ln_wage ib88.year

      Source |       SS           df       MS      Number of obs   =    28,534
-------------+----------------------------------   F(14, 28519)    =    160.14
       Model |  475.336723        14  33.9526231   Prob > F        =    0.0000
    Residual |  6046.54716    28,519  .212018204   R-squared       =    0.0729
-------------+----------------------------------   Adj R-squared   =    0.0724
       Total |  6521.88388    28,533  .228573367   Root MSE        =    .46045

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        year |
         68  |  -.4385766   .0157325   -27.88   0.000    -.4694131     -.40774
         69  |  -.3489046   .0162914   -21.42   0.000    -.3808366   -.3169727
         70  |  -.3728891    .014801   -25.19   0.000    -.4018997   -.3438784
         71  |  -.3330782   .0144174   -23.10   0.000    -.3613369   -.3048195
         72  |  -.3126545   .0147834   -21.15   0.000    -.3416307   -.2836783
         73  |  -.3014891   .0141543   -21.30   0.000    -.3292321    -.273746
         75  |  -.3000716   .0138689   -21.64   0.000    -.3272552   -.2728879
         77  |   -.221124   .0138194   -16.00   0.000    -.2482108   -.1940373
         78  |  -.1636474    .014187   -11.54   0.000    -.1914545   -.1358403
         80  |  -.1501639    .014426   -10.41   0.000    -.1784395   -.1218883
         82  |  -.1535051   .0139644   -10.99   0.000    -.1808761   -.1261342
         83  |  -.1116612   .0141429    -7.90   0.000    -.1393819   -.0839405
         85  |  -.0480949   .0139644    -3.44   0.001    -.0754658   -.0207239
         87  |  -.0379676   .0138309    -2.75   0.006    -.0650768   -.0108585
             |
       _cons |   1.879937   .0096601   194.61   0.000     1.861003    1.898871
------------------------------------------------------------------------------

If a prefix a mid-year year=77, I will get different estimates again: Wages are lower on average before 77 and higher after:

 reg ln_wage ib75.year

      Source |       SS           df       MS      Number of obs   =    28,534
-------------+----------------------------------   F(14, 28519)    =    160.14
       Model |  475.336723        14  33.9526231   Prob > F        =    0.0000
    Residual |  6046.54716    28,519  .212018204   R-squared       =    0.0729
-------------+----------------------------------   Adj R-squared   =    0.0724
       Total |  6521.88388    28,533  .228573367   Root MSE        =    .46045

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        year |
         68  |   -.138505    .015913    -8.70   0.000    -.1696952   -.1073148
         69  |  -.0488331   .0164657    -2.97   0.003    -.0811067   -.0165595
         70  |  -.0728175   .0149927    -4.86   0.000    -.1022038   -.0434312
         71  |  -.0330066    .014614    -2.26   0.024    -.0616509   -.0043624
         72  |  -.0125829   .0149753    -0.84   0.401    -.0419352    .0167694
         73  |  -.0014175   .0143546    -0.10   0.921    -.0295531    .0267181
         77  |   .0789475   .0140245     5.63   0.000     .0514588    .1064362
         78  |   .1364242   .0143868     9.48   0.000     .1082254     .164623
         80  |   .1499077   .0146225    10.25   0.000     .1212468    .1785685
         82  |   .1465665   .0141674    10.35   0.000     .1187977    .1743352
         83  |   .1884104   .0143433    13.14   0.000     .1602968    .2165239
         85  |   .2519767   .0141674    17.79   0.000      .224208    .2797455
         87  |    .262104   .0140358    18.67   0.000     .2345932    .2896147
         88  |   .3000716   .0138689    21.64   0.000     .2728879    .3272552
             |
       _cons |   1.579865   .0099513   158.76   0.000     1.560361     1.59937
------------------------------------------------------------------------------

In summary, if I change the base group I change the interpretation and exposition of the results but I do not change the main results. I assume the same is true in your example.

$\endgroup$
1
  • $\begingroup$ Thanks @emeryville. I understand what you've written - the gap between the years remains constant regardless of the base period, as displayed by the dummy variable coefficient estimates. What I'm asking about is the results of the margins command. I edited the post based on your feedback. $\endgroup$
    – sommertime
    Apr 19 '20 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.