Announcement

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

  • Cross regional comparison modeling

    Hello all,

    I have a panel dataset covering 100+ countries over a period of four years.


    I used a time and country fixed effects regression model to test the impact of market conditions (X1) and institutional quality (X2) on the outcome variable innovation. This was my first model.


    In another model, I would like to test the differences between specific regions, to check if certain market conditions (X1) lead to innovation more in North America (but not South America), while a certain level of institutional quality (X2) leads to innovation more in South America (but not North America).


    I want to say something to the effect of region 1 is impacted more by X1, while region 2 is impacted more by X2.


    Can anyone suggest how to model and test the way that different variables impact different regions?



    Thanks in advance
    Last edited by Nae Khar; 23 Jan 2024, 06:59.

  • #2
    A start would be:

    reghdfe Y X1 X2 i.region#(c.X1 c.X2) , absorb(country year)


    The interactions tell you how the coefficients vary by region and the t-stat is a test of the difference.

    You may want to choose the base region.






    Comment


    • #3
      Nae:
      as an aside to George's helpful reply, you can go -test- after running the community-contributed module -reghdfe-:
      Code:
      . use "https://www.stata-press.com/data/r18/nlswork.dta"
      (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
      
      . reghdfe ln_wage i.south##(c.grade c.tenure) , absorb( idcode year)
      (dropped 550 singleton observations)
      note: grade is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1.0e-09)
      (MWFE estimator converged in 8 iterations)
      note: grade omitted because of collinearity
      
      HDFE Linear regression                            Number of obs   =     27,541
      Absorbing 2 HDFE groups                           F(   4,  23376) =     189.11
                                                        Prob > F        =     0.0000
                                                        R-squared       =     0.6688
                                                        Adj R-squared   =     0.6098
                                                        Within R-sq.    =     0.0313
                                                        Root MSE        =     0.2973
      
      --------------------------------------------------------------------------------
             ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      ---------------+----------------------------------------------------------------
             1.south |  -.1193619   .0627026    -1.90   0.057    -.2422631    .0035392
               grade |          0  (omitted)
              tenure |   .0234125   .0009589    24.41   0.000     .0215329    .0252921
                     |
       south#c.grade |
                  1  |   .0047001   .0048202     0.98   0.330    -.0047478    .0141481
                     |
      south#c.tenure |
                  1  |  -.0064479   .0013522    -4.77   0.000    -.0090983   -.0037975
                     |
               _cons |   1.639251   .0058363   280.87   0.000     1.627811     1.65069
      --------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      -----------------------------------------------------+
       Absorbed FE | Categories  - Redundant  = Num. Coefs |
      -------------+---------------------------------------|
            idcode |      4147           0        4147     |
              year |        15           1          14     |
      -----------------------------------------------------+
      
      . mat list e(b)
      
      e(b)[1,9]
                  0b.          1.          o.               0b.south#    1.south#   0b.south#    1.south#            
               south       south       grade      tenure    co.grade     c.grade   co.tenure    c.tenure       _cons
      y1           0  -.11936193           0   .02341253           0   .00470015           0  -.00644791   1.6392506
      
      . test 0b.south#co.grade=1.south#c.grade
      
       ( 1)  0b.south#co.grade - 1.south#c.grade = 0
      
             F(  1, 23376) =    0.95
                  Prob > F =    0.3295
      
      . test 0b.south#co.tenure=1.south#c.tenure
      
       ( 1)  0b.south#co.tenure - 1.south#c.tenure = 0
      
             F(  1, 23376) =   22.74
                  Prob > F =    0.0000
      
      . test 0b.south#co.grade=1.south#c.tenure
      
       ( 1)  0b.south#co.grade - 1.south#c.tenure = 0
      
             F(  1, 23376) =   22.74
                  Prob > F =    0.0000
      
      . test 1.south#co.grade=1.south#c.tenure
      
       ( 1)  1.south#c.grade - 1.south#c.tenure = 0
      
             F(  1, 23376) =    4.85
                  Prob > F =    0.0276
      
      .
      Two asides:
      1) George's code and mine gives back the same coefficients. They are simply coded using the -fvvarlist- notation deifferently;
      2) you may have a multiple comparison issue that you can address by adjusting the arbitrary threshold value (0.05).
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Hello,

        Many thanks for your responses.

        The version of Stata that I had did not allow me to run that command due to an .ado error. I just purchased the recent version in order to run reghdfe.

        This is the initial command for the FE regression model across countries:

        Code:
        xtreg Innovation ICT_AnnualInvestment KnowledgeCapitalFem LaborForceParticipFem RegulatoryQualityEstimate DomesticCredit DomesticMarketScale FDINetOutflow_prcntGDP i.year, fe cluster (ccode)
        Results
        Code:
        . xtreg Innovation ICT_AnnualInvestment KnowledgeCapitalFem LaborForceParticipFem RegulatoryQualityEstimate DomesticCredit
        >  DomesticMarketScale FDINetOutflow_prcntGDP i.year, fe cluster (ccode)
        
        Fixed-effects (within) regression               Number of obs     =        378
        Group variable: ccode                           Number of groups  =         86
        
        R-squared:                                      Obs per group:
             Within  = 0.0938                                         min =          1
             Between = 0.2454                                         avg =        4.4
             Overall = 0.2327                                         max =          5
        
                                                        F(9, 85)          =          .
        corr(u_i, Xb) = 0.0617                          Prob > F          =          .
        
                                                      (Std. err. adjusted for 86 clusters in ccode)
        -------------------------------------------------------------------------------------------
                                  |               Robust
                       Innovation | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------------------+----------------------------------------------------------------
             ICT_AnnualInvestment |  -2.65e-11   1.25e-10    -0.21   0.833    -2.75e-10    2.22e-10
              KnowledgeCapitalFem |   .0403845   .0198062     2.04   0.045     .0010044    .0797646
            LaborForceParticipFem |   .2487981   .2057998     1.21   0.230     -.160387    .6579832
        RegulatoryQualityEstimate |   4.645617   5.832477     0.80   0.428     -6.95091    16.24214
                   DomesticCredit |   .0795429   .0661769     1.20   0.233    -.0520344    .2111202
              DomesticMarketScale |  -8.41e-13   2.00e-12    -0.42   0.675    -4.81e-12    3.13e-12
           FDINetOutflow_prcntGDP |   -.004221   .0042859    -0.98   0.327    -.0127424    .0043005
                                  |
                             year |
                            2018  |  -.1871494    .568596    -0.33   0.743    -1.317671    .9433717
                            2019  |   .0852974    .665093     0.13   0.898    -1.237086     1.40768
                            2020  |   1.650821    1.01293     1.63   0.107    -.3631553    3.664797
                            2021  |    1.26428   .9774844     1.29   0.199    -.6792205    3.207781
                                  |
                            _cons |   13.70258   14.99515     0.91   0.363    -16.11179    43.51695
        --------------------------+----------------------------------------------------------------
                          sigma_u |  19.452567
                          sigma_e |  4.4791494
                              rho |  .94964985   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------------------



        This is the new command suggested for the reghdfe model to test the differences between different regions and/or income levels.


        Code:
        reghdfe Innovation ICT_AnnualInvestment KnowledgeCapitalFem LaborForceParticipFem RegulatoryQualityEstimate DomesticCredit DomesticMarketScale FDINetOutflow_prcntGDP i.OECD_GCC_nonOECD#(c.ICT_AnnualInvestment c.KnowledgeCapitalFem c.LaborForceParticipFem c.RegulatoryQualityEstimate c.DomesticCredit c.DomesticMarketScale c.FDINetOutflow_prcntGDP), absorb (ccode year) cluster (ccode)

        Results
        Code:
        . reghdfe Innovation ICT_AnnualInvestment KnowledgeCapitalFem LaborForceParticipFem RegulatoryQualityEstimate DomesticCred
        > it DomesticMarketScale FDINetOutflow_prcntGDP i.OECD_GCC_nonOECD#(c.ICT_AnnualInvestment c.KnowledgeCapitalFem c.LaborFo
        > rceParticipFem c.RegulatoryQualityEstimate c.DomesticCredit c.DomesticMarketScale c.FDINetOutflow_prcntGDP), absorb (cco
        > de year) cluster (ccode)
        (dropped 4 singleton observations)
        (MWFE estimator converged in 5 iterations)
        
        HDFE Linear regression                            Number of obs   =        374
        Absorbing 2 HDFE groups                           F(  21,     81) =     321.86
        Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                          R-squared       =     0.9776
                                                          Adj R-squared   =     0.9687
                                                          Within R-sq.    =     0.3187
        Number of clusters (ccode)   =         82         Root MSE        =     3.9112
        
                                                                         (Std. err. adjusted for 82 clusters in ccode)
        --------------------------------------------------------------------------------------------------------------
                                                     |               Robust
                                          Innovation | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        ---------------------------------------------+----------------------------------------------------------------
                                ICT_AnnualInvestment |  -6.28e-10   4.88e-10    -1.29   0.201    -1.60e-09    3.42e-10
                                 KnowledgeCapitalFem |   .0070061   .0116414     0.60   0.549    -.0161566    .0301688
                               LaborForceParticipFem |   .4666831   .2352818     1.98   0.051     -.001454    .9348201
                           RegulatoryQualityEstimate |   2.414726   2.327388     1.04   0.303    -2.216046    7.045498
                                      DomesticCredit |   -.057472   .0568472    -1.01   0.315      -.17058    .0556361
                                 DomesticMarketScale |  -4.59e-12   3.78e-12    -1.22   0.228    -1.21e-11    2.93e-12
                              FDINetOutflow_prcntGDP |   .0036354   .0047642     0.76   0.448    -.0058439    .0131147
                                                     |
             OECD_GCC_nonOECD#c.ICT_AnnualInvestment |
                                                GCC  |  -9.72e-09   1.71e-08    -0.57   0.571    -4.37e-08    2.42e-08
                                       NonOECDOther  |   7.60e-10   5.51e-10     1.38   0.171    -3.36e-10    1.86e-09
                                                     |
              OECD_GCC_nonOECD#c.KnowledgeCapitalFem |
                                                GCC  |   .0984083   .0705587     1.39   0.167    -.0419813    .2387979
                                       NonOECDOther  |   .0237746   .0341944     0.70   0.489    -.0442615    .0918106
                                                     |
            OECD_GCC_nonOECD#c.LaborForceParticipFem |
                                                GCC  |  -1.581552   .4010099    -3.94   0.000    -2.379436   -.7836681
                                       NonOECDOther  |  -.3403535   .2724043    -1.25   0.215    -.8823527    .2016457
                                                     |
        OECD_GCC_nonOECD#c.RegulatoryQualityEstimate |
                                                GCC  |   44.64312   9.831089     4.54   0.000     25.08234    64.20391
                                       NonOECDOther  |  -8.326422   4.995615    -1.67   0.099    -18.26613    1.613285
                                                     |
                   OECD_GCC_nonOECD#c.DomesticCredit |
                                                GCC  |   .3771245   .0897349     4.20   0.000     .1985801    .5556689
                                       NonOECDOther  |   .0441025   .0629832     0.70   0.486    -.0812144    .1694193
                                                     |
              OECD_GCC_nonOECD#c.DomesticMarketScale |
                                                GCC  |  -1.71e-11   1.80e-10    -0.10   0.924    -3.75e-10    3.41e-10
                                       NonOECDOther  |   7.26e-12   5.35e-12     1.36   0.179    -3.39e-12    1.79e-11
                                                     |
           OECD_GCC_nonOECD#c.FDINetOutflow_prcntGDP |
                                                GCC  |  -1.501902   1.830026    -0.82   0.414    -5.143081    2.139276
                                       NonOECDOther  |  -.0061022   .0054991    -1.11   0.270    -.0170436    .0048392
                                                     |
                                               _cons |   22.65851   8.154325     2.78   0.007     6.433962    38.88306
        --------------------------------------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        -----------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
        -------------+---------------------------------------|
               ccode |        82          82           0    *|
                year |         5           1           4     |
        -----------------------------------------------------+
        * = FE nested within cluster; treated as redundant for DoF computation
        
        . mat list e(b)
        
        e(b)[1,29]
                                                                                                                      1b.OECD_GC~D#  2.OECD_GCC~D#
             ICT_Annual~t   KnowledgeC~m   LaborForce~m   Regulatory~e   DomesticCr~t   DomesticMa~e   FDINetOutf~P   co.ICT_Ann~t   c.ICT_Annu~t
        y1     -6.282e-10      .00700608      .46668307      2.4147261     -.05747197     -4.589e-12       .0036354              0     -9.725e-09
        
             3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#  3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#  3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#
             c.ICT_Annu~t   co.Knowled~m   c.Knowledg~m   c.Knowledg~m   co.LaborFo~m   c.LaborFor~m   c.LaborFor~m   co.Regulat~e   c.Regulato~e
        y1      7.600e-10              0      .09840833      .02377455              0      -1.581552     -.34035352              0      44.643123
        
             3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#  3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#  3.OECD_GCC~D#  1b.OECD_GC~D#  2.OECD_GCC~D#
             c.Regulato~e   co.Domesti~t   c.Domestic~t   c.Domestic~t   co.Domesti~e   c.Domestic~e   c.Domestic~e   co.FDINetO~P   c.FDINetOu~P
        y1     -8.3264219              0      .37712452      .04410248              0     -1.709e-11      7.259e-12              0     -1.5019023
        
             3.OECD_GCC~D#              
             c.FDINetOu~P          _cons
        y1     -.00610222      22.658511
        OECD_GCC_nonOECD has three levels (1 - OECD countries (base); 2 - GCC countries (non-OECD); 3 - All other non-OECD countries).


        1.How can the reghdfe results be interpreted? For example, regulatory quality for GCC is significant with coefficient 44.64. How can I interpret that?


        2.In my initial FE results, KnowledgeCapitalFem was significant (at the 5% level). In my reghdfe results, this changed to LaborForceParticpFem being significant (at the 10% level). How can this change in variables be interpreted as well?


        P.S. Sorry for the double post. I could not edit my previous post in time to remove the screenshots and post the model output in the proper form for this forum.

        Comment


        • #5
          Nae:
          your -reghdfe- code is too complicated with ton of interactions.
          I would get a rid of those interactions that do not reach statistical significance and re-run the -reghdfe- regression.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            I removed the four interactions that were not significant.

            Please note this changes the results in the first part of the model.

            LaborForceParticipFem was significant in the first part of model that had all the interactions.


            Code:
            . reghdfe Innovation ICT_AnnualInvestment KnowledgeCapitalFem LaborForceParticipFem RegulatoryQualityEstimate DomesticCredit DomesticMarketSca
            > le FDINetOutflow_prcntGDP i.OECD_GCC_nonOECD#(c.LaborForceParticipFem c.RegulatoryQualityEstimate c.DomesticCredit), absorb (ccode year) clu
            > ster (ccode)
            (dropped 4 singleton observations)
            (MWFE estimator converged in 5 iterations)
            
            HDFE Linear regression                            Number of obs   =        374
            Absorbing 2 HDFE groups                           F(  13,     81) =       3.83
            Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                              R-squared       =     0.9760
                                                              Adj R-squared   =     0.9675
                                                              Within R-sq.    =     0.2721
            Number of clusters (ccode)   =         82         Root MSE        =     3.9836
            
                                                                             (Std. err. adjusted for 82 clusters in ccode)
            --------------------------------------------------------------------------------------------------------------
                                                         |               Robust
                                              Innovation | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
            ---------------------------------------------+----------------------------------------------------------------
                                    ICT_AnnualInvestment |  -6.59e-11   1.23e-10    -0.54   0.593    -3.10e-10    1.78e-10
                                     KnowledgeCapitalFem |   .0295476   .0192644     1.53   0.129    -.0087826    .0678778
                                   LaborForceParticipFem |   .4000145    .255209     1.57   0.121    -.1077714    .9078003
                               RegulatoryQualityEstimate |   2.894192   2.392084     1.21   0.230    -1.865305     7.65369
                                          DomesticCredit |   -.052174   .0549684    -0.95   0.345    -.1615439    .0571958
                                     DomesticMarketScale |  -2.75e-13   1.90e-12    -0.14   0.885    -4.06e-12    3.51e-12
                                  FDINetOutflow_prcntGDP |   .0001356   .0039153     0.03   0.972    -.0076546    .0079259
                                                         |
                OECD_GCC_nonOECD#c.LaborForceParticipFem |
                                                    GCC  |  -1.807635   .4089455    -4.42   0.000    -2.621308   -.9939621
                                           NonOECDOther  |  -.2827893   .2860617    -0.99   0.326    -.8519624    .2863839
                                                         |
            OECD_GCC_nonOECD#c.RegulatoryQualityEstimate |
                                                    GCC  |   53.92886    10.3223     5.22   0.000     33.39072    74.46701
                                           NonOECDOther  |  -8.658478   5.044591    -1.72   0.090    -18.69563    1.378676
                                                         |
                       OECD_GCC_nonOECD#c.DomesticCredit |
                                                    GCC  |   .3193836   .0755769     4.23   0.000     .1690093    .4697579
                                           NonOECDOther  |   .0387375   .0617507     0.63   0.532    -.0841271    .1616021
                                                         |
                                                   _cons |   22.87117   7.684042     2.98   0.004     7.582341    38.16001
            --------------------------------------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            -----------------------------------------------------+
             Absorbed FE | Categories  - Redundant  = Num. Coefs |
            -------------+---------------------------------------|
                   ccode |        82          82           0    *|
                    year |         5           1           4     |
            -----------------------------------------------------+
            * = FE nested within cluster; treated as redundant for DoF computation
            
            .
            Last edited by Nae Khar; 17 Feb 2024, 11:57.

            Comment


            • #7
              Nae:
              it may also be that your "disappointing" results come from two different issues:
              1) variables have too different metrics;
              2) with all those predictors you're overfitting your regression model.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #8
                Thanks for your response. Can you please shed some light on:

                1. How can the reghdfe results be interpreted? For example, in my case if regulatory quality is significant only in the interactions for GCC with coefficient 53.92, how can I interpret that?


                2. If my initial fixed effects model results in KnowledgeCapitalFem being significant - but my reghdfe model results in a different variable (LaborForceParticpFem) being significant.
                How can this change in variables be interpreted as well?

                Comment

                Working...
                X