Announcement

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

  • Dealing with collinear fixed effects in interactions

    I have a question, which feels simple, but just making sure I'm doing the right thing.

    I have a regression simply stylized as below:

    y=B1-GDP +B2_region + B3_GDP*region+ country_fixed_effects +e

    I want to estimate the full GDP related slope by region (B1+ B2+B3), but of course B2 is collinear with fixed effects and falls out of the model. Is it permissible to simply add B1+ B3 and have an accurate estimation? and is there an appropriate way to do that in Stata? I've tried noestimcheck and have gotten some unusual results.

  • #2
    You can interact the region variable with GDP. Consider an industry variable in the Grunfeld dataset.

    Code:
    webuse grunfeld, clear
    gen industry= cond(_n<4, 1, cond(_n>6, 3, 2))
    xtset company year
    xtreg invest i.industry#(c.mvalue), fe
    Cluster on the panel identifier if you have enough clusters.

    Res.:

    Code:
    . xtreg invest i.industry#(c.mvalue), fe
    
    Fixed-effects (within) regression               Number of obs     =        200
    Group variable: company                         Number of groups  =         10
    
    R-squared:                                      Obs per group:
         Within  = 0.5722                                         min =         20
         Between = 0.8477                                         avg =       20.0
         Overall = 0.7763                                         max =         20
    
                                                    F(3, 187)         =      83.37
    corr(u_i, Xb) = -0.5003                         Prob > F          =     0.0000
    
    -----------------------------------------------------------------------------------
               invest | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    ------------------+----------------------------------------------------------------
    industry#c.mvalue |
                   1  |   .1119708   .0174366     6.42   0.000     .0775731    .1463685
                   2  |   .1216398   .0195803     6.21   0.000     .0830133    .1602664
                   3  |   .1924543   .0150358    12.80   0.000     .1627928    .2221159
                      |
                _cons |  -52.77321   17.06475    -3.09   0.002    -86.43737   -19.10905
    ------------------+----------------------------------------------------------------
              sigma_u |  91.668553
              sigma_e |   71.65442
                  rho |  .62073029   (fraction of variance due to u_i)
    -----------------------------------------------------------------------------------
    F test that all u_i=0: F(9, 187) = 24.48                     Prob > F = 0.0000

    Comment


    • #3
      That's what I thought was possible. but the models were inconsistent with each other, and I was worried about contaminating main effects and interactions. See below:

      Full disclosure, I'm using a gravity model, and here are some results:




      Code:
      . ppmlhdfe flows_zeroimputed L.c.ln_gdppercapitapppconsta20_or_c1##i.region_encoded4 if island==0 & trouble_amended==0, absorb(origincountrycode1 de
      > stinationcountrycode1#year) cluster(origincountrycode1) exposure(exposureflows)
      (dropped 1307 observations that are either singletons or separated by a fixed effect)
      note: 6 variables omitted because of collinearity: 3bn.region_encoded4 5bn.region_encoded4 6bn.region_encoded4 7bn.region_encoded4 8bn.region_encoded4 9bn.region_encoded4
      
      ------------------------------------------------------------------------------------------------------------
      (legend: p: exact partial-out   s: exact solver   h: step-halving   o: epsilon below tolerance)
      Converged in 13 iterations and 35 HDFE sub-iterations (tol = 1.0e-08)
      
      HDFE PPML regression                              No. of obs      =     64,213
      Absorbing 2 HDFE groups                           Residual df     =        141
      Statistics robust to heteroskedasticity           Wald chi2(11)   =     250.58
      Deviance             =  1040181.745               Prob > chi2     =     0.0000
      Log pseudolikelihood = -549018.0959               Pseudo R2       =     0.6353
      
      Number of clusters (origincountrycode1)=       142
                                                                (Std. err. adjusted for 142 clusters in origincountrycode1)
      ---------------------------------------------------------------------------------------------------------------------
                                                          |               Robust
                                        flows_zeroimputed | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      ----------------------------------------------------+----------------------------------------------------------------
                         ln_gdppercapitapppconsta20_or_c1 |
                                                      L1. |  -.7014653   .2302788    -3.05   0.002    -1.152803   -.2501271
                                                          |
                                          region_encoded4 |
                                                      EU  |   .8232494   .3502781     2.35   0.019      .136717    1.509782
                                     East Asia & Pacific  |          0  (omitted)
                          Europe & Central Asia (non-EU)  |  -.0127503    .355964    -0.04   0.971    -.7104269    .6849262
                               Latin America & Caribbean  |          0  (omitted)
                              Middle East & North Africa  |          0  (omitted)
                                           North America  |          0  (omitted)
                                              South Asia  |          0  (omitted)
                                      Sub-Saharan Africa  |          0  (omitted)
                                                          |
      region_encoded4#cL.ln_gdppercapitapppconsta20_or_c1 |
                                                      EU  |   .0844666   .3583593     0.24   0.814    -.6179047     .786838
                                     East Asia & Pacific  |    .046594   .3894805     0.12   0.905    -.7167737    .8099617
                          Europe & Central Asia (non-EU)  |   1.066893   .2585878     4.13   0.000     .5600699    1.573716
                               Latin America & Caribbean  |    -1.2602   .6194614    -2.03   0.042    -2.474322   -.0460781
                              Middle East & North Africa  |   1.809496   .8169123     2.22   0.027     .2083776    3.410615
                                           North America  |    -.76976   1.049406    -0.73   0.463    -2.826557    1.287037
                                              South Asia  |  -.7421439   .3784196    -1.96   0.050    -1.483833   -.0004551
                                      Sub-Saharan Africa  |   .5625568   .4028058     1.40   0.163    -.2269281    1.352042
                                                          |
                                                    _cons |  -7.883333    .179548   -43.91   0.000    -8.235241   -7.531425
                                        ln(exposureflows) |          1  (exposure)
      ---------------------------------------------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      ------------------------------------------------------------------------+
                          Absorbed FE | Categories  - Redundant  = Num. Coefs |
      --------------------------------+---------------------------------------|
                   origincountrycode1 |       142         142           0    *|
         destinationcountrycode1#year |       576           1         575     |
      ------------------------------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation


      Code:
      . ppmlhdfe flows_zeroimputed L.c.ln_gdppercapitapppconsta20_or_c1#i.region_encoded4 if island==0 & trouble_amended==0, absorb(origincountrycode1 destinationcountrycode1#year) cluster(origincountrycode1) exposure(exposureflows)
      (dropped 1307 observations that are either singletons or separated by a fixed effect)
      ------------------------------------------------------------------------------------------------------------
      (legend: p: exact partial-out   s: exact solver   h: step-halving   o: epsilon below tolerance)
      Converged in 13 iterations and 35 HDFE sub-iterations (tol = 1.0e-08)
      
      HDFE PPML regression                              No. of obs      =     64,213
      Absorbing 2 HDFE groups                           Residual df     =        141
      Statistics robust to heteroskedasticity           Wald chi2(9)    =      88.87
      Deviance             =  1043416.433               Prob > chi2     =     0.0000
      Log pseudolikelihood = -550635.4395               Pseudo R2       =     0.6343
      
      Number of clusters (origincountrycode1)=       142
                                                                (Std. err. adjusted for 142 clusters in origincountrycode1)
      ---------------------------------------------------------------------------------------------------------------------
                                                          |               Robust
                                        flows_zeroimputed | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      ----------------------------------------------------+----------------------------------------------------------------
      region_encoded4#cL.ln_gdppercapitapppconsta20_or_c1 |
                                            Central Asia  |  -.8957013   .2188236    -4.09   0.000    -1.324588   -.4668149
                                                      EU  |  -1.220628   .2629952    -4.64   0.000    -1.736089   -.7051665
                                     East Asia & Pacific  |  -.7877536   .3410951    -2.31   0.021    -1.456288   -.1192195
                          Europe & Central Asia (non-EU)  |  -.2227145   .2436369    -0.91   0.361     -.700234     .254805
                               Latin America & Caribbean  |  -2.212276   .6150915    -3.60   0.000    -3.417834   -1.006719
                              Middle East & North Africa  |   .8350103   .7386238     1.13   0.258    -.6126658    2.282686
                                           North America  |  -2.054071   1.059842    -1.94   0.053    -4.131323    .0231806
                                              South Asia  |  -1.565305   .2782182    -5.63   0.000    -2.110603   -1.020008
                                      Sub-Saharan Africa  |  -.3551148   .3809562    -0.93   0.351    -1.101775    .3915456
                                                          |
                                                    _cons |  -7.494623   .0168355  -445.17   0.000     -7.52762   -7.461626
                                        ln(exposureflows) |          1  (exposure)
      ---------------------------------------------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      ------------------------------------------------------------------------+
                          Absorbed FE | Categories  - Redundant  = Num. Coefs |
      --------------------------------+---------------------------------------|
                   origincountrycode1 |       142         142           0    *|
         destinationcountrycode1#year |       576           1         575     |
      ------------------------------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation

      Comment


      • #4
        In my example, one could estimate both industry and firm fixed effects if some firms changed industries over the sample period. However, as I understand it, all you need are regional-level coefficients, so you do not need to include region dummies in the specification. In your dataset, the EU is considered a region. Since the UK left the EU and other countries have joined over time, countries can, in this sense, change regions. Simply interact the independent variable of interest with the region dummies, and that should suffice.

        Comment

        Working...
        X