Announcement

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

  • Model diagnostics for three-dimensional panel data with reghdfe

    Hello! I am having some trouble running the necessary model diagnostics for a fixed effects regression undertaken with reghdfe for a three-dimensional panel dataset (index variables are reporting_econ_id, partner_econ_id and year). I first set up the panel structure of my dataset like this:

    Code:
    encode reportingecon, gen(reporting_econ_id)
    encode partnerecon, gen(partner_econ_id)
    
    egen panel_id = group(reporting_econ_id partner_econ_id)
    
    xtset panel_id year
    The resulting dataset looks like this:
    Code:
     Observations:        12,200                  
        Variables:            65                  7 Oct 2024 08:40
    -----------------------------------------------------------------------------------------
    Variable      Storage   Display    Value
        name         type    format    label      Variable label
    -----------------------------------------------------------------------------------------
    partnerecon     str14   %14s                  PartnerEcon
    reportingecon   str37   %37s                  ReportingEcon
    agree           float   %9.0g                
    year            int     %8.0g                 Year
    idealpointdis~e float   %9.0g                 IdealPointDistance
    region          str27   %27s                  
    buildingprodu~x float   %9.0g                 Building Productive Capacity.x
    economicinfra~x float   %9.0g                 Economic Infrastructure.x
    tradepolicyre~x float   %9.0g                 Trade Policy & Regulations.x
    traderelateda~x float   %8.0g                 Trade-related Adjustment.x
    total_aftx      float   %9.0g                 Total_AfT.x
    col_fr          byte    %8.0g                 COL_FR
    col_uk          byte    %8.0g                 COL_UK
    col_us          byte    %8.0g                 COL_US
    col_jp          byte    %8.0g                 COL_JP
    dist            float   %8.0g                
    distcap         float   %8.0g                
    distw           float   %8.0g                
    distwces        float   %8.0g                
    inflowsofasyl~s double  %10.0g                Inflows of asylum seekers
    inflowsoffore~n long    %8.0g                 Inflows of foreign population
    incomegroup     int     %8.0g                 IncomeGroup
    hdi             double  %10.0g                
    le              float   %9.0g                
    mys             float   %8.0g                
    gni_capita      double  %10.0g                
    lldcs           byte    %8.0g                 LLDCs
    count_interna~d int     %8.0g                
    count_intrast~e int     %8.0g                
    count_interst~e int     %8.0g                
    share_world_m~h float   %8.0g                 Share_World_Merch
    civ_liberties   byte    %8.0g                
    pol_freedom     byte    %8.0g                
    balanced_exp    float   %8.0g                 Balanced_EXP
    balanced_imp    float   %8.0g                 Balanced_IMP
    final_exp       float   %8.0g                 Final_EXP
    final_imp       float   %8.0g                 Final_IMP
    goodsexports    float   %8.0g                 GoodsExports
    goodsimports    float   %8.0g                 GoodsImports
    net_fdi         double  %8.0g                 Net_FDI
    sum_total_aft   float   %8.0g                
    other_aft       float   %8.0g                
    net_oda         float   %8.0g                 Net_ODA
    gdp             float   %8.0g                 GDP
    natural_resou~s float   %8.0g                
    reporting_eco~d long    %37.0g     reporting_econ_id
                                                  ReportingEcon
    partner_econ_id long    %14.0g     partner_econ_id
                                                  PartnerEcon
    panel_id        float   %9.0g                 group(reporting_econ_id partner_econ_id)
    mean_totalaft   float   %9.0g                
    ln_aft          float   %9.0g                
    ln_gnicap       float   %9.0g                
    ln_servicesexp  float   %9.0g                
    ln_servicesimp  float   %9.0g                
    ln_goodsexp     float   %9.0g                
    ln_goodsimp     float   %9.0g                
    ln_fdi          float   %9.0g                
    ln_gdp          float   %9.0g                
    ln_otheraft     float   %9.0g                
    ln_oda          float   %9.0g                
    ln_dist         float   %9.0g                
    partner_us      float   %9.0g                
    partner_jp      float   %9.0g                
    partner_fr      float   %9.0g                
    partner_uk      float   %9.0g                
    partner_ge      float   %9.0g                
    -----------------------------------------------------------------------------------------
    Sorted by: panel_id  year
    I run several nested models, all of which present a good (<0.001) F-statistic. I am presenting below the last model I run and its output:

    Code:
    reghdfe ln_aft ///
        c.hdi#i.partner_econ_id ///
        c.ln_gnicap#i.partner_econ_id ///
        c.pol_freedom#i.partner_econ_id ///
        lldcs#i.partner_econ_id ///
        c.share_world_merch#i.partner_econ_id ///
        c.count_internationalised#i.partner_econ_id ///
        c.count_intrastate#i.partner_econ_id ///
        c.agree#i.partner_econ_id ///
        c.ln_dist#i.partner_econ_id ///
        c.inflowsofforeignpopulation#i.partner_econ_id ///
        c.col_fr#i.partner_fr ///
        c.col_uk#i.partner_uk ///
        c.col_us#i.partner_us ///
        c.ln_servicesexp#i.partner_econ_id ///
        c.ln_servicesimp#i.partner_econ_id ///
        c.ln_goodsexp#i.partner_econ_id ///
        c.ln_goodsimp#i.partner_econ_id ///
        c.ln_fdi#i.partner_econ_id ///
        c.ln_gdp#i.partner_econ_id ///
        c.ln_otheraft#i.partner_econ_id ///
        c.ln_oda#i.partner_econ_id ///
        c.natural_resources#i.partner_econ_id, ///
        absorb(reporting_econ_id year) ///
        vce(cluster reporting_econ_id)
    Code:
    HDFE Linear regression                            Number of obs   =      3,394
    Absorbing 2 HDFE groups                           F( 101,    105) =   21660.24
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.6215
                                                      Adj R-squared   =     0.5958
                                                      Within R-sq.    =     0.3635
    Number of clusters (reporting_econ_id) =        106Root MSE       =     1.5892
    
                                (Std. err. adjusted for 106 clusters in reporting_econ_id)
    --------------------------------------------------------------------------------------
                         |               Robust
                  ln_aft | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    ---------------------+----------------------------------------------------------------
         partner_econ_id#|
                   c.hdi |
                 France  |  -8.365468   4.863386    -1.72   0.088    -18.00866    1.277727
                Germany  |   3.294893   4.579765     0.72   0.473    -5.785934    12.37572
                  Japan  |  -.2702511   5.346708    -0.05   0.960    -10.87179    10.33128
         United Kingdom  |  -21.16168   8.192214    -2.58   0.011    -37.40532    -4.91803
          United States  |   3.296014   4.816464     0.68   0.495    -6.254144    12.84617
                         |
         partner_econ_id#|
             c.ln_gnicap |
                 France  |   1.654401   .3692053     4.48   0.000     .9223349    2.386467
                Germany  |  -.2690675   .3143735    -0.86   0.394     -.892412     .354277
                  Japan  |   .1885545   .4065309     0.46   0.644    -.6175211    .9946301
         United Kingdom  |   1.550292    .751632     2.06   0.042     .0599441    3.040639
          United States  |  -.1473826   .3312212    -0.44   0.657    -.8041331    .5093679
                         |
         partner_econ_id#|
           c.pol_freedom |
                 France  |   -.020727   .1377542    -0.15   0.881    -.2938681    .2524141
                Germany  |  -.2221254    .093777    -2.37   0.020    -.4080678    -.036183
                  Japan  |  -.1019459     .09783    -1.04   0.300    -.2959248     .092033
         United Kingdom  |  -.0557523   .2033243    -0.27   0.784    -.4589068    .3474023
          United States  |  -.0473356   .1130292    -0.42   0.676    -.2714517    .1767804
                         |
                   lldcs#|
         partner_econ_id |
              0#Germany  |     19.686   8.013725     2.46   0.016     3.796268    35.57574
                0#Japan  |   33.09791   7.802076     4.24   0.000     17.62784    48.56799
       0#United Kingdom  |   14.82509   14.15851     1.05   0.297    -13.24861    42.89879
        0#United States  |   1.247056    8.29337     0.15   0.881    -15.19716    17.69128
               1#France  |  -2.582377   8.305405    -0.31   0.756    -19.05046    13.88571
              1#Germany  |    17.4672   7.124526     2.45   0.016      3.34058    31.59382
                1#Japan  |   30.54564    7.63674     4.00   0.000      15.4034    45.68789
       1#United Kingdom  |   15.82774   14.82191     1.07   0.288    -13.56137    45.21685
        1#United States  |          0  (omitted)
                         |
         partner_econ_id#|
     c.share_world_merch |
                 France  |   5.06e-09   1.56e-09     3.25   0.002     1.97e-09    8.15e-09
                Germany  |   7.84e-09   1.87e-09     4.20   0.000     4.14e-09    1.15e-08
                  Japan  |   1.33e-09   1.75e-09     0.76   0.450    -2.14e-09    4.80e-09
         United Kingdom  |   4.03e-09   2.98e-09     1.35   0.180    -1.89e-09    9.94e-09
          United States  |  -5.86e-10   1.88e-09    -0.31   0.756    -4.32e-09    3.15e-09
                         |
         partner_econ_id#|
                      c. |
    count_internationa~d |
                 France  |  -.1853612   .3224705    -0.57   0.567    -.8247606    .4540381
                Germany  |   .3177221   .2043412     1.55   0.123    -.0874488     .722893
                  Japan  |  -1.002047   .3420969    -2.93   0.004    -1.680362   -.3237322
         United Kingdom  |   1.223445   .3890161     3.14   0.002     .4520983    1.994792
          United States  |   .3365063   .2292649     1.47   0.145    -.1180837    .7910963
                         |
         partner_econ_id#|
      c.count_intrastate |
                 France  |  -.1750101   .2163461    -0.81   0.420    -.6039844    .2539642
                Germany  |  -.0597992   .1261983    -0.47   0.637    -.3100271    .1904287
                  Japan  |   .1070002   .1399799     0.76   0.446     -.170554    .3845544
         United Kingdom  |   .0940048   .2631432     0.36   0.722    -.4277596    .6157693
          United States  |  -.0741203   .2729971    -0.27   0.787    -.6154232    .4671826
                         |
         partner_econ_id#|
                 c.agree |
                 France  |  -.3751798   2.000095    -0.19   0.852       -4.341     3.59064
                Germany  |  -.8791131   1.258728    -0.70   0.486    -3.374939    1.616713
                  Japan  |  -3.347968   1.446109    -2.32   0.023    -6.215335   -.4806007
         United Kingdom  |  -7.730057   4.073688    -1.90   0.061    -15.80743    .3473138
          United States  |   1.982738    1.11721     1.77   0.079    -.2324823    4.197958
                         |
         partner_econ_id#|
               c.ln_dist |
                 France  |    1.06597   .4135629     2.58   0.011     .2459514    1.885989
                Germany  |  -.2094744   .2356301    -0.89   0.376    -.6766853    .2577365
                  Japan  |  -1.430836   .3959467    -3.61   0.000    -2.215925   -.6457466
         United Kingdom  |   3.303015    1.02918     3.21   0.002      1.26234    5.343689
          United States  |  -.3303684   .4735732    -0.70   0.487    -1.269377    .6086397
                         |
         partner_econ_id#|
                      c. |
    inflowsofforeignpo~n |
                 France  |   .0000397   .0000323     1.23   0.221    -.0000242    .0001037
                Germany  |  -4.63e-06   9.71e-06    -0.48   0.635    -.0000239    .0000146
                  Japan  |   .0000239   .0000188     1.27   0.208    -.0000135    .0000612
         United Kingdom  |   .0000103    .000019     0.54   0.588    -.0000273    .0000479
          United States  |   1.34e-06   7.16e-06     0.19   0.852    -.0000129    .0000155
                         |
     partner_fr#c.col_fr |
                      0  |  -.0216491   .0117221    -1.85   0.068    -.0448919    .0015937
                      1  |          0  (omitted)
                         |
     partner_uk#c.col_uk |
                      0  |   .0311397   .0112371     2.77   0.007     .0088585    .0534208
                      1  |          0  (omitted)
                         |
     partner_us#c.col_us |
                      0  |  -.0453175   .0155515    -2.91   0.004    -.0761532   -.0144818
                      1  |          0  (omitted)
                         |
         partner_econ_id#|
        c.ln_servicesexp |
                 France  |  -.1009793   .2092745    -0.48   0.630    -.5159319    .3139733
                Germany  |   -.207759   .1561096    -1.33   0.186    -.5172955    .1017776
                  Japan  |  -.2755614   .1402912    -1.96   0.052    -.5537329    .0026101
         United Kingdom  |   .8352024    .433984     1.92   0.057    -.0253078    1.695713
          United States  |  -.1605652    .185467    -0.87   0.389     -.528312    .2071815
                         |
         partner_econ_id#|
        c.ln_servicesimp |
                 France  |   .6009642   .3221383     1.87   0.065    -.0377766    1.239705
                Germany  |   .2302156   .1748801     1.32   0.191    -.1165393    .5769705
                  Japan  |   .2120279   .1970995     1.08   0.285    -.1787841    .6028398
         United Kingdom  |  -1.694077   .4940615    -3.43   0.001     -2.67371   -.7144445
          United States  |  -.0054276   .1892335    -0.03   0.977    -.3806427    .3697875
                         |
         partner_econ_id#|
           c.ln_goodsexp |
                 France  |   .1951882    .097819     2.00   0.049     .0012312    .3891453
                Germany  |   .0984622   .0580864     1.70   0.093    -.0167125    .2136368
                  Japan  |   .0798342   .0472478     1.69   0.094    -.0138493    .1735178
         United Kingdom  |  -.1348263   .2461635    -0.55   0.585    -.6229231    .3532705
          United States  |   .0000854   .0625908     0.00   0.999    -.1240207    .1241915
                         |
         partner_econ_id#|
           c.ln_goodsimp |
                 France  |   .1697972   .1846939     0.92   0.360    -.1964168    .5360111
                Germany  |   .3880155   .1473953     2.63   0.010     .0957578    .6802732
                  Japan  |   .2614983   .1054035     2.48   0.015     .0525025     .470494
         United Kingdom  |   2.576976   .6400928     4.03   0.000     1.307791    3.846162
          United States  |   .1719541   .1727773     1.00   0.322    -.1706314    .5145395
                         |
         partner_econ_id#|
                c.ln_fdi |
                 France  |  -.0145596   .1069726    -0.14   0.892    -.2266665    .1975473
                Germany  |   .1115391   .0939308     1.19   0.238    -.0747083    .2977864
                  Japan  |   .0547202   .0833109     0.66   0.513      -.11047    .2199104
         United Kingdom  |  -.2255714   .2416279    -0.93   0.353    -.7046748    .2535321
          United States  |   .2981682   .0998416     2.99   0.004     .1002007    .4961356
                         |
         partner_econ_id#|
                c.ln_gdp |
                 France  |   .2970983   .7400153     0.40   0.689    -1.170215    1.764412
                Germany  |   .3629671   .6773162     0.54   0.593    -.9800258     1.70596
                  Japan  |   .6390817   .6335713     1.01   0.315    -.6171731    1.895337
         United Kingdom  |  -.2613469   .9532113    -0.27   0.784    -2.151389    1.628695
          United States  |   .7210528   .7093308     1.02   0.312    -.6854192    2.127525
                         |
         partner_econ_id#|
           c.ln_otheraft |
                 France  |  -.3257992   .1550674    -2.10   0.038    -.6332691   -.0183292
                Germany  |  -.4180295   .1444829    -2.89   0.005    -.7045124   -.1315466
                  Japan  |  -.3335356   .1180767    -2.82   0.006    -.5676599   -.0994112
         United Kingdom  |   .0687922   .3324009     0.21   0.836    -.5902974    .7278818
          United States  |  -.7653098    .162958    -4.70   0.000    -1.088425   -.4421941
                         |
         partner_econ_id#|
                c.ln_oda |
                 France  |   .5525117   .1661286     3.33   0.001     .2231093    .8819141
                Germany  |   .4890086   .1321145     3.70   0.000     .2270501    .7509672
                  Japan  |    .183862   .1384814     1.33   0.187    -.0907211    .4584451
         United Kingdom  |   .0938438   .2027709     0.46   0.644    -.3082134     .495901
          United States  |   .8958777   .2354309     3.81   0.000     .4290618    1.362694
                         |
         partner_econ_id#|
     c.natural_resources |
                 France  |   .0266695   .0220096     1.21   0.228    -.0169715    .0703105
                Germany  |   .0160756   .0178215     0.90   0.369    -.0192611    .0514123
                  Japan  |   .0079434   .0157231     0.51   0.614    -.0232325    .0391194
         United Kingdom  |   -.039139   .1104802    -0.35   0.724    -.2582009    .1799229
          United States  |   .0093805   .0170574     0.55   0.584    -.0244412    .0432021
                         |
                   _cons |  -36.39202   14.46701    -2.52   0.013    -65.07744   -7.706611
    --------------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------------+
           Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------------+---------------------------------------|
     reporting_econ_id |       106         106           0    *|
                  year |        11           1          10     |
    -----------------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    However, I am now running into issues trying to run model diagnostics, such as B-P/LM test using xttest2 or Pasaran CD test using xtcsd. For xttest2, I receive the following error: "Error: too few common observations across panel to compute full rank VCE"; while for xtcsd I receive the following "Error: The panel is highly unbalanced. Not enough common observations across panel to perform Pesaran's test. Insufficient observations". I believe these erros might be due to the fact that my panel dataset has panel_id as the cross-section identifier. How can I fix these issues and still run my model diagnostics? Thank you in advance!
    Last edited by Andrea Gimeno Solaz; 07 Oct 2024, 09:42.

  • #2
    Andrea:
    welcome to this forum.
    Some comments about your query:
    1) your model is very complicated;
    2) in case of small T and large N, the Breusch-Pagan test is not valid;
    3) the error message after -xtcsd- is due to your dataset. In addition, I am not clear with the way you created your -panelid-;
    4) I would be more interested in ruing out misspecifications of the functional form of the regressand, replicating by hand the -linktest- approach, as you can see in the following toy-example:
    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 c.age##c.age, abs(idcode year) vce(cluster idcode)
    (dropped 551 singleton observations)
    (MWFE estimator converged in 8 iterations)
    
    HDFE Linear regression                            Number of obs   =     27,959
    Absorbing 2 HDFE groups                           F(   2,   4158) =      44.91
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.6593
                                                      Adj R-squared   =     0.5995
                                                      Within R-sq.    =     0.0115
    Number of clusters (idcode)  =      4,159         Root MSE        =     0.3013
    
                                 (Std. err. adjusted for 4,159 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .0728746   .0136873     5.32   0.000     .0460402    .0997089
                 |
     c.age#c.age |  -.0010113   .0001076    -9.39   0.000    -.0012224   -.0008003
                 |
           _cons |   .4586164   .3651743     1.26   0.209    -.2573205    1.174553
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4159        4159           0    *|
            year |        15           0          15     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    . predict fitted, xb
    (24 missing values generated)
    
    . gen sq_fitted=fitted^2
    (24 missing values generated)
    
    . reghdfe ln_wage fitted sq_fitted , abs(idcode year) vce(cluster idcode)
    (dropped 551 singleton observations)
    (MWFE estimator converged in 8 iterations)
    
    HDFE Linear regression                            Number of obs   =     27,959
    Absorbing 2 HDFE groups                           F(   2,   4158) =      55.72
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.6598
                                                      Adj R-squared   =     0.6001
                                                      Within R-sq.    =     0.0129
    Number of clusters (idcode)  =      4,159         Root MSE        =     0.3011
    
                                 (Std. err. adjusted for 4,159 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          fitted |   6.536005   1.294478     5.05   0.000     3.998137    9.073873
       sq_fitted |  -1.730508    .404729    -4.28   0.000    -2.523993   -.9370228
           _cons |  -4.401739   1.037021    -4.24   0.000    -6.434853   -2.368624
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4159        4159           0    *|
            year |        15           0          15     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    .
    As expected, this toy-example shows misspecificaction as the -sq_fitted- term of the the auxiliary regression is highly significant.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Dear Mr. Lazzaro, thank you very much for your response and your help. I understand the issue you describe about misspecifications of the functional form of the regression - I was then wondering what your suggestion would be for the best approach to deal with my dataset and the analysis I want to run. The dataset is three-dimensional as it compiles data from aid flows to several recipient countries (reporting_econ_id), by five different partner countries (partner_econ_id), and each combination of reporting-partner country contains time-series data (year) between 2005 and 2021.

      My goal with this analysis is to explore whether the driving factors behind aid flows to reporting economies vary across the selected partner economies (hence, the interaction terms between all of my independent variables and the partner_econ_id variable).

      Because of this three-dimensional structure, I was not able to set up the panel structure of the dataset as xtest reporting_econ_id year (because then I get an error saying there are repeated time observations). That is why I tried to go around this by creating the identifying variable panel_id, which groups reporting_econ_id and partner_econ_id together to create one unique identifier, and then I used this panel_id together with year to establish the panel data structure of the dataset.

      Thank you very much again for your help.

      All the best,

      Andrea

      Comment


      • #4
        Andrea:
        thanks for clarifying,
        You do not need to -xtset- your panel dataset with -timevar- (-panelid- only is mandatory), unless you're planning to use time-series commands (such as lags and leads) to analyse your data.
        That said, you can still your -timevar- as a predcitor.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Dear Mr. Lazzaro,

          Thank you very much for the clarification. So I replicated your example for manually reproducing the -linktest- approach, as you can see below:

          Code:
           reghdfe ln_aft ///
          >         c.hdi#i.partner_econ_id ///
          >         c.ln_gnicap#i.partner_econ_id ///
          >         c.pol_freedom#i.partner_econ_id ///
          >         c.share_world_merch#i.partner_econ_id ///
          >         c.count_internationalised#i.partner_econ_id ///
          >         c.count_intrastate#i.partner_econ_id ///
          >         c.agree#i.partner_econ_id ///
          >         c.ln_dist#i.partner_econ_id ///
          >         c.inflowsofforeignpopulation#i.partner_econ_id ///
          >         c.col_fr#1.partner_econ_id ///
          >         c.col_uk#4.partner_econ_id ///
          >         c.col_us#5.partner_econ_id ///
          >     c.ln_servicesexp#i.partner_econ_id ///
          >         c.ln_servicesimp#i.partner_econ_id ///
          >         c.ln_goodsexp#i.partner_econ_id ///
          >         c.ln_goodsimp#i.partner_econ_id ///
          >         c.ln_fdi#i.partner_econ_id ///
          >         c.ln_gdp#i.partner_econ_id ///
          >         c.ln_otheraft#i.partner_econ_id ///
          >         c.ln_oda#i.partner_econ_id ///
          >         c.natural_resources#i.partner_econ_id, ///
          >     absorb(reporting_econ_id year) ///
          >     vce(cluster reporting_econ_id)
          (MWFE estimator converged in 5 iterations)
          
          HDFE Linear regression                            Number of obs   =      3,394
          Absorbing 2 HDFE groups                           F(  93,    105) =   26877.17
          Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                            R-squared       =     0.6043
                                                            Adj R-squared   =     0.5784
                                                            Within R-sq.    =     0.3344
          Number of clusters (reporting_econ_id) =        106Root MSE       =     1.6231
          
                                        (Std. err. adjusted for 106 clusters in reporting_econ_id)
          ----------------------------------------------------------------------------------------
                                 |               Robust
                          ln_aft | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -----------------------+----------------------------------------------------------------
           partner_econ_id#c.hdi |
                         France  |  -9.774424    4.86841    -2.01   0.047    -19.42758   -.1212671
                        Germany  |   1.754164   4.649332     0.38   0.707    -7.464603    10.97293
                          Japan  |  -1.351766   5.303489    -0.25   0.799    -11.86761    9.164074
                 United Kingdom  |   -20.2625   8.642618    -2.34   0.021    -37.39922    -3.12579
                  United States  |   4.447394   4.937665     0.90   0.370    -5.343084    14.23787
                                 |
                 partner_econ_id#|
                     c.ln_gnicap |
                         France  |   1.629878   .3645321     4.47   0.000     .9070784    2.352678
                        Germany  |  -.0697332   .3210155    -0.22   0.828    -.7062477    .5667813
                          Japan  |     .49134   .3927402     1.25   0.214    -.2873913    1.270071
                 United Kingdom  |   1.755348   .7696412     2.28   0.025     .2292913    3.281404
                  United States  |  -.4558249   .3520782    -1.29   0.198    -1.153931    .2422811
                                 |
                 partner_econ_id#|
                   c.pol_freedom |
                         France  |  -.0932653    .138572    -0.67   0.502    -.3680279    .1814972
                        Germany  |  -.2096648   .0941688    -2.23   0.028     -.396384   -.0229455
                          Japan  |  -.0776171   .1020882    -0.76   0.449    -.2800392    .1248051
                 United Kingdom  |  -.0738517   .1888351    -0.39   0.697    -.4482769    .3005734
                  United States  |  -.0157842   .1156214    -0.14   0.892    -.2450401    .2134718
                                 |
                 partner_econ_id#|
             c.share_world_merch |
                         France  |   5.55e-09   1.74e-09     3.19   0.002     2.10e-09    9.00e-09
                        Germany  |   6.99e-09   1.89e-09     3.70   0.000     3.25e-09    1.07e-08
                          Japan  |   4.91e-10   1.71e-09     0.29   0.775    -2.90e-09    3.88e-09
                 United Kingdom  |   6.37e-09   2.87e-09     2.22   0.028     6.84e-10    1.21e-08
                  United States  |   4.25e-10   1.78e-09     0.24   0.812    -3.11e-09    3.95e-09
                                 |
                 partner_econ_id#|
                              c. |
          count_internationali~d |
                         France  |  -.2066316   .3224321    -0.64   0.523    -.8459549    .4326917
                        Germany  |   .2801063   .2106067     1.33   0.186    -.1374878    .6977004
                          Japan  |  -1.099743   .3584609    -3.07   0.003    -1.810505   -.3889816
                 United Kingdom  |   .9411661   .4569142     2.06   0.042     .0351897    1.847143
                  United States  |   .6019295   .2314808     2.60   0.011     .1429459    1.060913
                                 |
                 partner_econ_id#|
              c.count_intrastate |
                         France  |  -.1697378   .2274151    -0.75   0.457    -.6206601    .2811844
                        Germany  |  -.1121022   .1292339    -0.87   0.388    -.3683492    .1441447
                          Japan  |   .1842267   .1752289     1.05   0.296    -.1632198    .5316732
                 United Kingdom  |   .0510352   .2834562     0.18   0.857    -.5110062    .6130765
                  United States  |  -.0151646   .2884437    -0.05   0.958    -.5870952     .556766
                                 |
                 partner_econ_id#|
                         c.agree |
                         France  |   -2.41855   2.092758    -1.16   0.250    -6.568102    1.731002
                        Germany  |   .1471977   1.307049     0.11   0.911    -2.444438    2.738834
                          Japan  |  -1.390888   1.656588    -0.84   0.403    -4.675595     1.89382
                 United Kingdom  |  -4.832314    3.96525    -1.22   0.226    -12.69467    3.030045
                  United States  |   2.480542   1.247521     1.99   0.049     .0069379    4.954147
                                 |
                 partner_econ_id#|
                       c.ln_dist |
                         France  |   .5646493   .3782154     1.49   0.138    -.1852819     1.31458
                        Germany  |  -.2937255   .2219439    -1.32   0.189    -.7337993    .1463482
                          Japan  |  -.6858377   .4129811    -1.66   0.100    -1.504703    .1330275
                 United Kingdom  |   2.223294   1.038035     2.14   0.035     .1650627    4.281525
                  United States  |  -.7813526   .4535387    -1.72   0.088    -1.680636    .1179309
                                 |
                 partner_econ_id#|
                              c. |
          inflowsofforeignpopu~n |
                         France  |   .0000306   .0000324     0.94   0.347    -.0000336    .0000948
                        Germany  |  -5.96e-06   9.93e-06    -0.60   0.550    -.0000257    .0000137
                          Japan  |   .0000454   .0000293     1.55   0.124    -.0000127    .0001035
                 United Kingdom  |    .000022   .0000214     1.03   0.307    -.0000205    .0000644
                  United States  |  -2.44e-06   6.75e-06    -0.36   0.719    -.0000158     .000011
                                 |
                 partner_econ_id#|
                        c.col_fr |
                         France  |   .0130181   .0087437     1.49   0.140    -.0043191    .0303553
                                 |
                 partner_econ_id#|
                        c.col_uk |
                 United Kingdom  |  -.0237955   .0125387    -1.90   0.060    -.0486575    .0010664
                                 |
                 partner_econ_id#|
                        c.col_us |
                  United States  |   .0444401   .0152937     2.91   0.004     .0141155    .0747646
                                 |
                 partner_econ_id#|
                c.ln_servicesexp |
                         France  |  -.1295067   .2169798    -0.60   0.552    -.5597375    .3007241
                        Germany  |  -.1768757   .1513394    -1.17   0.245    -.4769538    .1232023
                          Japan  |  -.2530778    .146205    -1.73   0.086    -.5429753    .0368197
                 United Kingdom  |   .7495948   .4542527     1.65   0.102    -.1511043    1.650294
                  United States  |  -.2579884   .2010137    -1.28   0.202    -.6565614    .1405846
                                 |
                 partner_econ_id#|
                c.ln_servicesimp |
                         France  |   .6254141   .3171176     1.97   0.051    -.0033716      1.2542
                        Germany  |   .1737926   .1753416     0.99   0.324    -.1738773    .5214626
                          Japan  |   .0971037   .2054254     0.47   0.637    -.3102169    .5044243
                 United Kingdom  |  -1.346223   .5504452    -2.45   0.016    -2.437655   -.2547921
                  United States  |   .1794095   .2190367     0.82   0.415    -.2548998    .6137188
                                 |
                 partner_econ_id#|
                   c.ln_goodsexp |
                         France  |   .2435825   .0916151     2.66   0.009     .0619267    .4252383
                        Germany  |   .0589114   .0589896     1.00   0.320    -.0580542     .175877
                          Japan  |    .049922   .0495375     1.01   0.316    -.0483016    .1481457
                 United Kingdom  |  -.3051458   .2553684    -1.19   0.235    -.8114941    .2012025
                  United States  |  -.0198432   .0650736    -0.30   0.761    -.1488722    .1091857
                                 |
                 partner_econ_id#|
                   c.ln_goodsimp |
                         France  |    .268227    .188086     1.43   0.157    -.1047127    .6411667
                        Germany  |   .3279165   .1393334     2.35   0.020     .0516441    .6041888
                          Japan  |   .1859517   .1078043     1.72   0.087    -.0278044    .3997078
                 United Kingdom  |   1.448157   .4357101     3.32   0.001     .5842249     2.31209
                  United States  |   .1219501   .1744274     0.70   0.486    -.2239073    .4678074
                                 |
                 partner_econ_id#|
                        c.ln_fdi |
                         France  |   .0328726   .1092139     0.30   0.764    -.1836783    .2494235
                        Germany  |   .1313913   .0889613     1.48   0.143    -.0450025     .307785
                          Japan  |   .0797486   .0869451     0.92   0.361    -.0926475    .2521447
                 United Kingdom  |  -.4663534   .2563915    -1.82   0.072    -.9747305    .0420237
                  United States  |   .2350082   .1098859     2.14   0.035     .0171247    .4528917
                                 |
                 partner_econ_id#|
                        c.ln_gdp |
                         France  |   .1692535   .6951185     0.24   0.808    -1.209038    1.547545
                        Germany  |   .5913072   .6749127     0.88   0.383    -.7469201    1.929534
                          Japan  |   .9110806   .6366517     1.43   0.155    -.3512821    2.173443
                 United Kingdom  |   .4966505   .9158035     0.54   0.589    -1.319219     2.31252
                  United States  |   .7073532   .7093183     1.00   0.321     -.699094      2.1138
                                 |
                 partner_econ_id#|
                   c.ln_otheraft |
                         France  |  -.3035774   .1521357    -2.00   0.049    -.6052343   -.0019205
                        Germany  |  -.4945058   .1474889    -3.35   0.001     -.786949   -.2020625
                          Japan  |  -.4801013   .1113553    -4.31   0.000    -.7008984   -.2593043
                 United Kingdom  |  -.0677292   .3317936    -0.20   0.839    -.7256147    .5901562
                  United States  |  -.6690468   .1501203    -4.46   0.000    -.9667075    -.371386
                                 |
                 partner_econ_id#|
                        c.ln_oda |
                         France  |   .3812168   .1459949     2.61   0.010      .091736    .6706977
                        Germany  |   .6039819   .1399394     4.32   0.000     .3265079     .881456
                          Japan  |    .457013   .1416147     3.23   0.002     .1762172    .7378088
                 United Kingdom  |    .163035   .2023019     0.81   0.422    -.2380922    .5641623
                  United States  |   .7048839   .1891274     3.73   0.000     .3298792    1.079889
                                 |
                 partner_econ_id#|
             c.natural_resources |
                         France  |   .0165229   .0228758     0.72   0.472    -.0288356    .0618814
                        Germany  |   .0167739   .0184246     0.91   0.365    -.0197586    .0533065
                          Japan  |   .0162419   .0160979     1.01   0.315    -.0156772     .048161
                 United Kingdom  |   .0734116   .0815908     0.90   0.370    -.0883679     .235191
                  United States  |   .0078063   .0180705     0.43   0.667    -.0280241    .0436368
                                 |
                           _cons |  -24.94542   13.56641    -1.84   0.069    -51.84511    1.954272
          ----------------------------------------------------------------------------------------
          
          Absorbed degrees of freedom:
          -----------------------------------------------------------+
                 Absorbed FE | Categories  - Redundant  = Num. Coefs |
          -------------------+---------------------------------------|
           reporting_econ_id |       106         106           0    *|
                        year |        11           1          10     |
          -----------------------------------------------------------+
          * = FE nested within cluster; treated as redundant for DoF computation
          
          predict fitted, xb
          (8,251 missing values generated)
          
          gen sq_fitted=fitted^2
          (8,251 missing values generated)
          
           reghdfe ln_aft fitted sq_fitted , abs(reporting_econ_id year) vce(cluster reporting_eco
          > n_id)
          (MWFE estimator converged in 5 iterations)
          
          HDFE Linear regression                            Number of obs   =      3,394
          Absorbing 2 HDFE groups                           F(   2,    105) =     270.35
          Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                            R-squared       =     0.6045
                                                            Adj R-squared   =     0.5903
                                                            Within R-sq.    =     0.3348
          Number of clusters (reporting_econ_id) =        106Root MSE       =     1.5999
          
                              (Std. err. adjusted for 106 clusters in reporting_econ_id)
          ------------------------------------------------------------------------------
                       |               Robust
                ln_aft | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                fitted |   1.014911   .0514039    19.74   0.000     .9129864    1.116835
             sq_fitted |   -.006426   .0074768    -0.86   0.392    -.0212511    .0083991
                 _cons |   .0247937   .0582262     0.43   0.671    -.0906581    .1402454
          ------------------------------------------------------------------------------
          
          Absorbed degrees of freedom:
          -----------------------------------------------------------+
                 Absorbed FE | Categories  - Redundant  = Num. Coefs |
          -------------------+---------------------------------------|
           reporting_econ_id |       106         106           0    *|
                        year |        11           1          10     |
          -----------------------------------------------------------+
          * = FE nested within cluster; treated as redundant for DoF computation
          My sq_fitted term is not statistically significant, therefore should I understand that the model is working properly? Would I need to run additional model diagnostics?

          Thank you very much again for your help.

          Comment


          • #6
            Andrea (please, Carlo is enough. Thanks):
            with so many predictors this was expected.
            Stick with your current model, then.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment

            Working...
            X