Announcement

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

  • Jump in coefficients value after interacting a time dummy with the initial model's regressors

    Dear Statlist members,
    Good afternoon.
    I am estimating a translog cost function intending to measure the efficiency of the Syrian banking sector, my sample includes 17 banks (out of a total of 20 banks) for 12 years starting from 2005 till 2016 (yielding an unbalanced panel data). To check the variability of the my sample, my supervisor proposed to perform a regression between on 3 stages: the first stage would be to run a regression (according to the Hausman test, the results were in favor of using the fixed effects model) to check for the coefficients of my regressors, then the second step would be to run the same regression but adding a time dummy (represents a crisis dummy that takes the value of zero in the pre-war period 2005-2011, and takes the value of 1 in the war period 2012-2016), and finally the third step is to interact the crisis dummy with all my regressors and check the coefficients from this step with the value of the coefficients from the first step.
    I chose my dependent variable as the ln(total cost/one of the input prices) and my regressors are three outputs (in logarithms), 2 price inputs (taken in logarithm form and divided by the third input price as we did with the total costs), 2 control variables (in logarithm form) and the interactions between the outputs, the input prices, and the control variables, this would yield 30 regressors in the initial model. In the second model, I added the crisis dummy, in the third model I added the interactions between the crisis dummy with all the regressors in the first model so we would have 61 regressors. The values of the coefficients in the first model and second model were almost the same but to my surprise, the coefficients of the regressors in the third model were so huge (and almost all of the coefficients are significant) compared to to the same regressors in the first and second models.
    • To define my regressors in a macro:
    Code:
    global xvar lntl lnoea lnnii lnw2D lnw3D lntl2 lnoea2 lnnii2 lnw2D2 lnw3D2 lneq lnllp lneq2 lnllp2 iact1 iact2 iact3 iact4 iact5 iact6 iact7 iact8 iact9 iact10 iact11 iact12 iact13 iact14 iact15 iact16
    • Code:
      xtset id year
    • Code:
      xtreg lntcD $xvar, fe
    • The results of the first model:
    • Code:
      Fixed-effects (within) regression               Number of obs     =        111
      	Group variable: id                              Number of groups  =         17
      	
      	R-sq:                                           Obs per group:
      	     within  = 0.9795                                         min =          2
      	     between = 0.5923                                         avg =        6.5
      	     overall = 0.8121                                         max =          9
      	
      	                                                F(30,64)          =     101.82
      	corr(u_i, Xb)  = -0.1038                        Prob > F          =     0.0000
      	
      	------------------------------------------------------------------------------
      	       lntcD |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      	-------------+----------------------------------------------------------------
      	        lntl |  -.8543398   1.502416    -0.57   0.572     -3.85576    2.147081
      	       lnoea |  -2.668691   1.575779    -1.69   0.095    -5.816671    .4792895
      	       lnnii |   .2089025   .2709448     0.77   0.444    -.3323719     .750177
      	       lnw2D |   1.004794    .700106     1.44   0.156    -.3938285    2.403417
      	       lnw3D |   .0003386   1.399373     0.00   1.000     -2.79523    2.795908
      	       lntl2 |   .0758403   .0854099     0.89   0.378    -.0947857    .2464662
      	      lnoea2 |  -.1743747   .1219659    -1.43   0.158    -.4180296    .0692803
      	      lnnii2 |    .010878   .0099781     1.09   0.280    -.0090555    .0308116
      	      lnw2D2 |   .0005951   .0409005     0.01   0.988     -.081113    .0823032
      	      lnw3D2 |  -.0235098   .0699826    -0.34   0.738    -.1633161    .1162966
      	        lneq |    .108945   1.304998     0.08   0.934    -2.498087    2.715977
      	       lnllp |   1.133728   .3713425     3.05   0.003     .3918864     1.87557
      	       lneq2 |  -.2203478    .104942    -2.10   0.040    -.4299935   -.0107021
      	      lnllp2 |   .0146593    .010815     1.36   0.180    -.0069461    .0362647
      	       iact1 |  -.0136558   .0438129    -0.31   0.756    -.1011822    .0738706
      	       iact2 |   .1070544   .0616944     1.74   0.088    -.0161942     .230303
      	       iact3 |   .1039922   .0739666     1.41   0.165    -.0437731    .2517575
      	       iact4 |   .0393443   .0991637     0.40   0.693     -.158758    .2374465
      	       iact5 |   .0147782   .0188256     0.79   0.435    -.0228301    .0523866
      	       iact6 |   .0110684   .0205931     0.54   0.593    -.0300711    .0522078
      	       iact7 |  -.1555763   .0583796    -2.66   0.010     -.272203   -.0389496
      	       iact8 |  -.0425453   .0895008    -0.48   0.636    -.2213437     .136253
      	       iact9 |   .0114676   .0189465     0.61   0.547    -.0263824    .0493175
      	      iact10 |  -.0923999   .0198445    -4.66   0.000    -.1320438   -.0527559
      	      iact11 |  -.0366808   .0548468    -0.67   0.506    -.1462499    .0728882
      	      iact12 |   .2972163    .099944     2.97   0.004     .0975553    .4968774
      	      iact13 |  -.0242802   .0185953    -1.31   0.196    -.0614285    .0128681
      	      iact14 |  -.0499301   .0195805    -2.55   0.013    -.0890467   -.0108136
      	      iact15 |   .0304576   .0207391     1.47   0.147    -.0109737    .0718888
      	      iact16 |  -.0072393   .0116585    -0.62   0.537    -.0305299    .0160513
      	       _cons |   31.09566   17.05464     1.82   0.073    -2.974905    65.16622
      	-------------+----------------------------------------------------------------
      	     sigma_u |  .60556741
      	     sigma_e |  .16679111
      	         rho |  .92948776   (fraction of variance due to u_i)
      	------------------------------------------------------------------------------
      	F test that all u_i=0: F(16, 64) = 6.21                      Prob > F = 0.0000
    • To add the crisis dummy:
    • Code:
      global xvar1 lntl lnoea lnnii lnw2D lnw3D lntl2 lnoea2 lnnii2 lnw2D2 lnw3D2 lneq lnllp lneq2 lnllp2 iact1 iact2 iact3 iact4 iact5 iact6 iact7 iact8 iact9 iact10 iact11 iact12 iact13 iact14 iact15 iact16 cd
    • Code:
      xtreg lntcD $xvar1, fe
    • The results of the second model:
    • Code:
      Fixed-effects (within) regression               Number of obs     =        111
      	Group variable: id                              Number of groups  =         17
      	
      	R-sq:                                           Obs per group:
      	     within  = 0.9795                                         min =          2
      	     between = 0.5999                                         avg =        6.5
      	     overall = 0.8157                                         max =          9
      	
      	                                                F(31,63)          =      97.03
      	corr(u_i, Xb)  = -0.0964                        Prob > F          =     0.0000
      	
      	------------------------------------------------------------------------------
      	       lntcD |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      	-------------+----------------------------------------------------------------
      	        lntl |   -.859437   1.514366    -0.57   0.572    -3.885655    2.166781
      	       lnoea |    -2.6956   1.597465    -1.69   0.096    -5.887879    .4966785
      	       lnnii |   .2134203   .2745974     0.78   0.440    -.3353188    .7621594
      	       lnw2D |   1.005569   .7055249     1.43   0.159    -.4043095    2.415448
      	       lnw3D |  -.0188541   1.415633    -0.01   0.989    -2.847771    2.810063
      	       lntl2 |   .0773606   .0866299     0.89   0.375    -.0957555    .2504767
      	      lnoea2 |  -.1715172   .1242915    -1.38   0.172     -.419894    .0768596
      	      lnnii2 |    .010869   .0100553     1.08   0.284    -.0092249    .0309628
      	      lnw2D2 |   .0017487   .0418873     0.04   0.967    -.0819563    .0854537
      	      lnw3D2 |  -.0235178   .0705225    -0.33   0.740    -.1644458    .1174102
      	        lneq |    .132109    1.32359     0.10   0.921    -2.512874    2.777092
      	       lnllp |   1.125977   .3775578     2.98   0.004     .3714874    1.880466
      	       lneq2 |  -.2189145    .106158    -2.06   0.043    -.4310543   -.0067746
      	      lnllp2 |   .0143052   .0111369     1.28   0.204    -.0079501    .0365606
      	       iact1 |  -.0139907   .0442042    -0.32   0.753    -.1023256    .0743443
      	       iact2 |     .10676   .0621995     1.72   0.091    -.0175358    .2310558
      	       iact3 |   .1041202   .0745418     1.40   0.167    -.0448397    .2530802
      	       iact4 |   .0403293    .100132     0.40   0.688    -.1597686    .2404272
      	       iact5 |   .0144918   .0190612     0.76   0.450     -.023599    .0525826
      	       iact6 |   .0105911   .0209808     0.50   0.615    -.0313356    .0525178
      	       iact7 |  -.1551023     .05891    -2.63   0.011    -.2728245   -.0373801
      	       iact8 |  -.0417318   .0903449    -0.46   0.646    -.2222717    .1388081
      	       iact9 |   .0110464   .0192864     0.57   0.569    -.0274943    .0495872
      	      iact10 |  -.0925893   .0200352    -4.62   0.000    -.1326263   -.0525522
      	      iact11 |  -.0370671   .0553265    -0.67   0.505    -.1476282     .073494
      	      iact12 |   .2943027   .1024665     2.87   0.006     .0895397    .4990656
      	      iact13 |  -.0244373   .0187663    -1.30   0.198    -.0619388    .0130641
      	      iact14 |  -.0502809   .0198618    -2.53   0.014    -.0899715   -.0105903
      	      iact15 |   .0314099   .0217898     1.44   0.154    -.0121335    .0749534
      	      iact16 |  -.0069394   .0119078    -0.58   0.562    -.0307352    .0168564
      	          cd |   .0153238   .0992154     0.15   0.878    -.1829423    .2135899
      	       _cons |   31.30776   17.24099     1.82   0.074    -3.145606    65.76113
      	-------------+----------------------------------------------------------------
      	     sigma_u |  .59855999
      	     sigma_e |  .16807782
      	         rho |  .92691233   (fraction of variance due to u_i)
      	------------------------------------------------------------------------------
      	F test that all u_i=0: F(16, 63) = 5.64                      Prob > F = 0.0000
    • To interact the crisis dummy with the regressors
    • Code:
      foreach x of varlist lntl lnoea lnnii lnw2D lnw3D lntl2 lnoea2 lnnii2 lnw2D2 lnw3D2 lneq lnllp lneq2 lnllp2 iact1 iact2 iact3 iact4 iact5 iact6 iact7 iact8 iact9 iact10 iact11 iact12 iact13 iact14 iact15 iact16{
    • Code:
      gen double cd`x' = cd * (`x')
    • Code:
      }
    • Include all the regressors and the interaction with the regressors in the third model:
    • Code:
      global xvar2 lntl lnoea lnnii lnw2D lnw3D lntl2 lnoea2 lnnii2 lnw2D2 lnw3D2 lneq lnllp lneq2 lnllp2 iact1 iact2 iact3 iact4 iact5 iact6 iact7 iact8 iact9 iact10 iact11 iact12 iact13 iact14 iact15 iact16 cd cdlntl cdlnoea cdlnnii cdlnw2D cdlnw3D cdlntl2 cdlnoea2 cdlnnii2 cdlnw2D2 cdlnw3D2 cdlneq cdlnllp cdlneq2 cdlnllp2 cdiact1 cdiact2 cdiact3 cdiact4 cdiact5 cdiact6 cdiact7 cdiact8 cdiact9 cdiact10 cdiact11 cdiact12 cdiact13 cdiact14 cdiact15 cdiact16
    • Code:
      xtreg lntcD $xvar2, fe
    • The resultsof the third model:
    • Code:
      Fixed-effects (within) regression               Number of obs     =        111
      	Group variable: id                              Number of groups  =         17
      	
      	R-sq:                                           Obs per group:
      	     within  = 0.9947                                         min =          2
      	     between = 0.2097                                         avg =        6.5
      	     overall = 0.5612                                         max =          9
      	
      	                                                F(61,33)          =     101.97
      	corr(u_i, Xb)  = -0.2020                        Prob > F          =     0.0000
      	
      	------------------------------------------------------------------------------
      	       lntcD |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      	-------------+----------------------------------------------------------------
      	        lntl |   47.09133   14.91185     3.16   0.003     16.75293    77.42973
      	       lnoea |  -46.40368    14.0999    -3.29   0.002    -75.09013   -17.71722
      	       lnnii |    4.37507    1.88242     2.32   0.026     .5452585    8.204882
      	       lnw2D |   1.100498   3.348964     0.33   0.745     -5.71302    7.914015
      	       lnw3D |   19.17671   6.098829     3.14   0.004     6.768545    31.58487
      	       lntl2 |  -1.799829   .4239165    -4.25   0.000    -2.662294   -.9373648
      	      lnoea2 |   .8813601   .4463555     1.97   0.057    -.0267571    1.789477
      	      lnnii2 |   .0544818   .0397587     1.37   0.180     -.026408    .1353715
      	      lnw2D2 |  -1.032923   .2472421    -4.18   0.000    -1.535941    -.529905
      	      lnw3D2 |  -.2459903   .4326006    -0.57   0.573    -1.126123    .6341423
      	        lneq |  -29.03087   9.461581    -3.07   0.004     -48.2806   -9.781139
      	       lnllp |  -3.008367   1.966399    -1.53   0.136    -7.009036    .9923016
      	       lneq2 |   .3430149   .5905285     0.58   0.565    -.8584244    1.544454
      	      lnllp2 |  -.0981912   .0384162    -2.56   0.015    -.1763495   -.0200328
      	       iact1 |   1.841016   .5717113     3.22   0.003     .6778605    3.004171
      	       iact2 |  -1.801202   .6411307    -2.81   0.008    -3.105592   -.4968115
      	       iact3 |  -.7978385   .4025068    -1.98   0.056    -1.616745    .0210676
      	       iact4 |   .6622181   .3090564     2.14   0.040     .0334381    1.290998
      	       iact5 |   .1290717   .1018969     1.27   0.214    -.0782392    .3363825
      	       iact6 |  -.2824996   .1258163    -2.25   0.032    -.5384747   -.0265244
      	       iact7 |  -1.362191   .4328597    -3.15   0.003     -2.24285    -.481531
      	       iact8 |   .8699046   .4723241     1.84   0.075    -.0910461    1.830855
      	       iact9 |   .3260643    .091666     3.56   0.001     .1395684    .5125601
      	      iact10 |  -.5697394   .0937982    -6.07   0.000    -.7605734   -.3789055
      	      iact11 |   -.765502    .484363    -1.58   0.124    -1.750946    .2199418
      	      iact12 |   1.807147   .4855092     3.72   0.001     .8193708    2.794923
      	      iact13 |   .0254151   .1274403     0.20   0.843    -.2338641    .2846944
      	      iact14 |   .7476658   .1699423     4.40   0.000     .4019157    1.093416
      	      iact15 |  -.0806342   .1316575    -0.61   0.544    -.3484933     .187225
      	      iact16 |   -.201224   .0706172    -2.85   0.007    -.3448958   -.0575523
      	          cd |  -146.8053   65.18711    -2.25   0.031    -279.4295   -14.18115
      	      cdlntl |  -44.43249   14.84393    -2.99   0.005    -74.63269    -14.2323
      	     cdlnoea |   49.45785   14.24765     3.47   0.001     20.47078    78.44492
      	     cdlnnii |  -4.480562   1.991074    -2.25   0.031    -8.531434    -.429691
      	     cdlnw2D |  -.0143426   3.363131    -0.00   0.997    -6.856683    6.827998
      	     cdlnw3D |  -25.36333   6.401982    -3.96   0.000    -38.38826    -12.3384
      	     cdlntl2 |   1.727536   .4276136     4.04   0.000     .8575497    2.597522
      	    cdlnoea2 |   -1.39611   .4913676    -2.84   0.008    -2.395805   -.3964154
      	    cdlnnii2 |  -.0619074   .0396564    -1.56   0.128     -.142589    .0187741
      	    cdlnw2D2 |   1.217328    .268301     4.54   0.000     .6714655    1.763191
      	    cdlnw3D2 |   .0988369   .4576092     0.22   0.830     -.832176     1.02985
      	      cdlneq |   31.12527   9.460709     3.29   0.002     11.87731    50.37323
      	     cdlnllp |   3.286925   2.004197     1.64   0.111    -.7906452    7.364495
      	     cdlneq2 |  -.5015864   .5895298    -0.85   0.401    -1.700994     .697821
      	    cdlnllp2 |    .168012   .0649718     2.59   0.014     .0358258    .3001981
      	     cdiact1 |  -1.816611   .5699775    -3.19   0.003    -2.976239   -.6569834
      	     cdiact2 |   1.881834    .648641     2.90   0.007     .5621645    3.201504
      	     cdiact3 |   .7273724   .3893951     1.87   0.071    -.0648578    1.519603
      	     cdiact4 |  -.2111172   .3302419    -0.64   0.527    -.8829994    .4607651
      	     cdiact5 |  -.1428134   .1035163    -1.38   0.177    -.3534189     .067792
      	     cdiact6 |   .2599114   .1259827     2.06   0.047     .0035976    .5162252
      	     cdiact7 |   1.379313   .4379577     3.15   0.003     .4882818    2.270345
      	     cdiact8 |  -.9126804   .4920562    -1.85   0.073    -1.913776    .0884154
      	     cdiact9 |  -.3629481   .0998283    -3.64   0.001    -.5660503   -.1598459
      	    cdiact10 |   .5378179   .1133859     4.74   0.000     .3071326    .7685032
      	    cdiact11 |   .6821611   .4743148     1.44   0.160    -.2828396    1.647162
      	    cdiact12 |  -1.682702   .5045611    -3.33   0.002    -2.709239   -.6561646
      	    cdiact13 |  -.0402936   .1287717    -0.31   0.756    -.3022816    .2216945
      	    cdiact14 |  -.8163593   .1742462    -4.69   0.000    -1.170866   -.4618527
      	    cdiact15 |   .0707761   .1403209     0.50   0.617    -.2147089    .3562611
      	    cdiact16 |   .2462194   .0743865     3.31   0.002     .0948788      .39756
      	       _cons |   125.5604   68.69779     1.83   0.077    -14.20634    265.3271
      	-------------+----------------------------------------------------------------
      	     sigma_u |  .89100955
      	     sigma_e |  .11779067
      	         rho |  .98282358   (fraction of variance due to u_i)
      	------------------------------------------------------------------------------
      	F test that all u_i=0: F(16, 33) = 4.69                      Prob > F = 0.0001
    As you can see, the coefficients in the third model are very huge compared to the results of the first model and the second model. Is there any feedback or comments on the results especially in the third model compared to the second and the first?
    Many thanks in advance

  • #2
    Well, I don't think there's anything really wrong here. When you have an interaction model, the coefficient of x in the interaction model is not estimating the same thing as the coefficient of x in the model without the interaction(s). They are different things and there is no reason to expect them to be the same, or even close, or even have the same sign. In fact, the whole point of adding interactions is to separate them.

    So when you have x in a non-interaction model, you are estimating an overall slope of the y:x relationship, irrespective of the value of cd. But when you have an x##cd interaction, you are saying that there is no such thing as the slope of the y:x relationship. You are saying that there are two different y:x relationships, one for cd = 0 and the other for cd = 1. The coefficient of x in the interaction model gives you the slope of the y:x relationship conditional on cd = 0, and the slope of the y:x relationship for cd = 1 is the coefficient of x PLUS the coefficient of x#cd. There is no reason, a priori to expect that either of these slopes will look like the overall slope of the unconditional y:x relationship.

    In fact, although I don't understand what your different variables are and have no understanding of the general content area you are working in, I suspect that your supervisor asked you to try the interaction model precisely because they suspected that some of these relationships may be very different in the crisis and non-crisis eras and having a non-interaction model that does not account for that difference may be obscuring some important phenomena. So I suspect that your results are precisely what your supervisor was looking for (or, perhaps, was afraid you might find).

    As an aside, the coding of the interaction model can be greatly simplified. There is no need to create the interaction variables you generated. Stata's factor variable notation will do this automatically and in a foolproof way for you:

    Code:
    local xvar1 c.(lntl lnoea lnnii lnw2D lnw3D lntl2 lnoea2 lnnii2 lnw2D2 lnw3D2 lneq lnllp lneq2 lnllp2) i.(iact1 iact2 iact3 iact4 iact5 iact6 iact7 iact8 iact9 iact10 iact11 iact12 iact13 iact14 iact15 iact16)
    
    // MODEL WITHOUT CRISIS
    xtreg lntcD `xvar1', fe
    
    // MODEL WITH CRISIS, NO INTERACTION
    xtreg lntcD i.cd `xvar1', fe
    
    // MODEL WITH CRISIS AND INTERACTIONS
    xtreg lntcD i.cd##(`xvar1'), fe
    Notes:
    1. I made the guess that all of the variables beginning with ln are continuous (hence take c. prefix) and those beginning with i are categorical (hence take i. prefix)--modify according to the reality.

    2. I used a local macro instead of a global macro. I will spare you my long rant about why global macros should be avoided except when there is no possible alternative. This is certainly not one of those unusual situations, and a local is safer.

    Finally, there is one problem I have with this model as a whole: the data set is really too small to support it. With 111 observations, you do not have nearly enough observations to get reliable estimates for 30+ predictor variables. You are in serious danger of simply overfitting the noise in your data (and it is possible, by the way, that when you go to the interaction model and effectively split the 111 observations into two subsets each half that size, the noise rather than anything in reality is why the results are so different when cd = 0 from when cd = 1.) You either need to get a much larger data set, or you need to radically simplify the model to have reliable results.

    Last edited by Clyde Schechter; 27 Apr 2019, 12:16. Reason: Correct error in code.

    Comment


    • #3
      Dear Professor Schechter,

      First of all, I’d like to thank you sincerely for this excellent well-understood reply which really highlighted some of my concerns especially the short T and small N that was and still of my concern. Unfortunately, the Syrian banking sector is relatively small and young therefore the data I worked with is whatever available, and this is due to the fact that the first private bank operated in Syria was in the year 2005, that it is why I had T=12 and N=17.

      My model is about measuring the cost efficiency of the Syrian banking sector using a parametric model which is SFA (Stochastic Frontier Analysis) during this 12 years period and this is partially for investigating how the behavior of the cost efficiency has changed over the 12 years (in the pre-war era compared to the war era). Ultimately, the cost efficiency that results from using SFA would be compared to the efficiency that will result from applying another model which is non-parametric (Data Envelopment Analysis, DEA). Thus the consistency conditions set by Bauer et. al (1998) would be applied on the results generated from SFA and DEA to optimally choose the best representative method for the Syrian case.

      As you stated, my supervisor had the concern for using a short panel that is why he proposed to use these models (compare the one with no interactions to the one with interactions) as a preliminary check before proceeding with the cost efficiency models.

      All the variables whether starting with (ln) or (i) are continuous and I have modified the code provided by including the (c.) as a prefix for all of them in the first code and the results were the same as mine so at least I’m a bit relieved that my work is right and the problem lies within the short panel I have.

      I will try to simplify the model by excluding two control variables from the original cost function which if “eliminated” will result in the drop of 14 regressors from the non-interaction model.

      Once again, I thank you sincerely Dr. Schechter for the excellent explanation and the provided codes and I wish you a very pleasant evening.
      Best Regards,
      Mazen

      Comment

      Working...
      X