Announcement

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

  • My regression results do not change in my 3rd sample. Appreciate help!

    Hi all,

    I am running the code below where I perform a regression with an interaction term for three different samples. First, with 69 countries. Then, I drop variables resulting in 43. My final sample consists of 24.
    The regression results for 69 and 43 countries are different. However, the results for 43 and 24 are the same.
    This is very weird, as I delete observations. Moreover, the summary statistics for 69, 43 and 24 countries are different.

    I have a feeling that it's due to the interaction term, since when I perform the analysis without this term, I get normal (different results) for 69, 43 and 24 countries. I appreciate all the help:

    Code:
    // Setting the directory and importing the dataset
    clear
    cd "/Users/matthijskallen/Desktop/MSc Finance/MSc Thesis Microfinance /STATA/Inter. POLS Dataset 29-11"
    import excel "/Users/MMMXXX/Desktop/MSc Finance/MSc Thesis Microfinance /STATA/POLS Dataset 24-11/Panel Data 17-10.xlsx", sheet("Data") firstrow
    
    // Drop some variables with no information
    drop AI AJ AK AL AM AN AO
    
    // Summary statistics
    asdoc sum, save(Descriptives 69 countries) dec(3) title(Descriptive statistics 69 countries) replace
    
    // Here we examine the regression for 69 countries, POLS C = 0, Where we replicate Hermes (2014)
    reg Gini_DispSWIID c.GLPIntensity##c.MAS InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    //Table for 69 countries, from Hermes excluding Swaziland
    outreg2 using GLPTablecountries, word label replace adjr2 ctitle(The impact of GLP on Gini - 69 countries)
    
    //Regressions, include an interaction term
    reg Gini_DispSWIID BorrowerIntensity InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    outreg2 using BITablecountries, word label replace adjr2 ctitle(The impact of BI on Gini - 69 countries)
    
    // We drop Benin, Cameroon, Chad, Congo Rep., Congo Dem. Rep., Cote d'Ivoire, Guinea, Kenya, Madagascar, Malawi, Mozambique, Niger, Senegal, Sierra Leone, Togo, Tunisia, Mongolia, Nepal, Sri Lanka, Tajikistan, Timor-East, Yemen Rep., Haiti, Honduras, Paraguay, Russian Federation (26 countries) since we have no Hofstede data --> 43 left.
    kountry Country, from(other) stuck
    
    rename _ISO3N_ Country_ID
    
    // Timor-East has no CountryID, so we have to drop it in another way.
    drop if Country_ID==204
    drop if Country_ID==120
    drop if Country_ID==148
    drop if Country_ID==178
    drop if Country_ID==180
    drop if Country_ID==384
    drop if Country_ID==324
    drop if Country_ID==404
    drop if Country_ID==450
    drop if Country_ID==454
    drop if Country_ID==508
    drop if Country_ID==562
    drop if Country_ID==686
    drop if Country_ID==694
    drop if Country_ID==768
    drop if Country_ID==788
    drop if Country_ID==496
    drop if Country_ID==524
    drop if Country_ID==144
    drop if Country_ID==762
    drop if Country_ID==887
    drop if Country_ID==332
    drop if Country_ID==340
    drop if Country_ID==600
    drop if Country_ID==810
    drop in 442/462
    
    // Here we examine the regressions for 43 countries, dropped due to no Hofstede data.
    
    //Summary Statistics
    asdoc sum, save(Descriptives 43 countries) dec(3) title(Descriptive statistics 43 countries) replace
    
    //Regressions
    reg Gini_DispSWIID c.GLPIntensity##c.MAS InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    outreg2 using GLPTablecountries, word label append adjr2 ctitle(The impact of GLP on Gini - 43 countries)
    
    reg Gini_DispSWIID BorrowerIntensity InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    outreg2 using BITablecountries, word label append adjr2 ctitle(The impact of BI on the Gini Index - 43 countries)
    
    // Now we drop the countries for which we don't have PDI/IDV/MAS/UAI data.
    // Therefore, we drop Albania, Armenia, Burkina Faso, Dominican Rep, Egypt, Ethiopia, Georgia, Ghana, Jordan, Kyrgyz Rep., Macedonia, Mali, Moldova, Nigeria, Rwanda, South Africa, Tanzania, Uganda, Zambia.
    //North Macedonia has no CountryID, so we have to drop it in another way.
    drop if Country_ID==8
    drop if Country_ID==51
    drop if Country_ID==854
    drop if Country_ID==214
    drop if Country_ID==818
    drop if Country_ID==231
    drop if Country_ID==268
    drop if Country_ID==288
    drop if Country_ID==400
    drop if Country_ID==417
    drop if Country_ID==466
    drop if Country_ID==498
    drop if Country_ID==566
    drop if Country_ID==646
    drop if Country_ID==710
    drop if Country_ID==834
    drop if Country_ID==800
    drop if Country_ID==894
    drop in 442/462
    
    //This leaves us with 24 countries, namely Morocco, Bangladesh, China, India, Indonesia, Pakistan, Philippines, Thailand, Vietnam, Argentina, Brazil, Chile, Costa Rica, Ecuador, El Salvador, Guatemala, Mexico, Panama, Peru, Venezuela, Bulgaria, Romania, Serbia, Turkiye
    
    //Summary Statistics
    asdoc sum, save(Descriptives 24 countries) dec(3) title(Descriptive statistics 24 countries) replace
    
    //Regressions
    reg Gini_DispSWIID c.GLPIntensity##c.MAS InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    outreg2 using GLPTablecountries, word seeout label append adjr2 ctitle(The impact of GLP on the Gini - 24 countries)
    
    reg Gini_DispSWIID BorrowerIntensity InflationGDPdeflatorannual Ruralpopulation Populationgrowthannual TradeofGDP Schoolenrollmentsecondary GDPgrowthadjustedforinflati Wageandsalariedworkerstotal Currenthealthexpenditureof LevelofdemocracyPolityV Arablelandoftotal
    
    outreg2 using BITablecountries, word seeout label append adjr2 ctitle(The impact of BI on the Gini - 24 countries)
    WITH interaction term
    Code:
     
    (1) (2) (3)
    VARIABLES The impact of GLP on Gini - 69 countries The impact of GLP on Gini - 43 countries The impact of GLP on the Gini - 24 countries
    GLP Intensity -327.0*** -308.5** -308.5**
    (120.6) (120.3) (120.3)
    MAS -0.0511*** -0.0422*** -0.0422***
    (0.0161) (0.0162) (0.0162)
    c.GLPIntensity#c.MAS 4.625** 4.309** 4.309**
    (2.121) (2.118) (2.118)
    Inflation, GDP deflator (annual %) -0.103** -0.125** -0.125**
    (0.0514) (0.0538) (0.0538)
    Rural population, as a % of total -20.99*** -22.91*** -22.91***
    (2.503) (2.575) (2.575)
    Population growth (annual %) 1.229*** 1.506*** 1.506***
    (0.312) (0.319) (0.319)
    Trade (% of GDP) 0.0176** 0.0296*** 0.0296***
    (0.00773) (0.00858) (0.00858)
    School enrollment, secondary (% gross) -0.0239* -0.0216 -0.0216
    (0.0143) (0.0146) (0.0146)
    GDP growth (adjusted for inflation) 0.0688 0.0550 0.0550
    (0.0481) (0.0499) (0.0499)
    Wage and salaried workers, total (% of total employment) -0.312*** -0.347*** -0.347***
    (0.0191) (0.0216) (0.0216)
    Current health expenditure (% of GDP) 0.224* 0.357*** 0.357***
    (0.122) (0.128) (0.128)
    Level of democracy (Polity V) 0.774*** 0.843*** 0.843***
    (0.0794) (0.0836) (0.0836)
    Arable land (% of total) -0.155*** -0.139*** -0.139***
    (0.0171) (0.0175) (0.0175)
    Constant 68.00*** 67.50*** 67.50***
    (3.027) (3.032) (3.032)
    Observations 324 309 309
    Adjusted R-squared 0.781 0.776 0.776
    Standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1
    WITHOUT interaction term:
    Code:
     
    (1) (2) (3)
    VARIABLES The impact of BI on Gini - 69 countries The impact of BI on the Gini Index - 43 countries The impact of BI on the Gini - 24 countries
    Borrower Intensity -19.18*** -23.57*** -22.84***
    (7.074) (7.590) (4.759)
    Inflation, GDP deflator (annual %) 0.0726 0.0724 -0.0688
    (0.0584) (0.0754) (0.0516)
    Rural population, as a % of total -2.121 0.620 -15.65***
    (1.625) (2.118) (2.067)
    Population growth (annual %) 2.098*** 1.853*** 1.752***
    (0.248) (0.271) (0.265)
    Trade (% of GDP) -0.0620*** -0.0881*** 0.0195***
    (0.00733) (0.00889) (0.00699)
    School enrollment, secondary (% gross) 0.0468*** 0.00879 -0.00626
    (0.0156) (0.0183) (0.0126)
    GDP growth (adjusted for inflation) 0.173*** 0.215*** 0.111**
    (0.0537) (0.0687) (0.0471)
    Wage and salaried workers, total (% of total employment) -0.0164 -0.00183 -0.280***
    (0.0163) (0.0202) (0.0189)
    Current health expenditure (% of GDP) 0.311*** 0.504*** 0.420***
    (0.111) (0.142) (0.120)
    Level of democracy (Polity V) 0.346*** 0.607*** 0.650***
    (0.0713) (0.0881) (0.0659)
    Arable land (% of total) -0.0620*** -0.105*** -0.144***
    (0.0162) (0.0194) (0.0158)
    Constant 39.20*** 40.34*** 58.75***
    (1.933) (2.412) (2.114)
    Observations 792 583 352
    Adjusted R-squared 0.236 0.337 0.755
    Standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1
    Please let me know if you have any solutions! It is very very much appreciated.

    Kind regards,
    Matt
    Last edited by Mattthew Kellan; 30 Nov 2022, 07:35.

  • #2
    Matt:
    interaction scenario: the number of observations and the coefficients are the same across (2) and (3): my but feeling is that it's the very same stuff.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo, thank you for your quick reply.

      But, how can it be the same stuff, when the descriptive statistics differ? Please see them below. They're computed in the same DO-file as described above!

      The observations for the interaction term, GLPItensity*IDV, change. Note that GLPI goes from 806 to 440. The observations for PDI, IDV, MAS and UAI (cultural dimensions) however remain the same. The interaction term should change however... Right?

      Code:
      Descriptive statistics 43 countries     
      Variable Obs Mean Std. Dev. Min Max
      Year 903 2009 6.059 1999 2019
      GLPIntensity 806 .009 .015 0 .193
      GrossLoanPortfolio 810 9.327e+08 2.507e+09 354 2.698e+10
      BorrowerIntensity 805 .019 .029 0 .17
      NumberofActiveBorr~s 805 1529358 4744804.9 2 39514842
      GiniIndexWorldBank 497 41.571 8.013 25.7 64.8
      Gini DispSWIID 854 41.769 6.418 28.1 63.1
      Gini Disp SESWIID 854 1.419 .542 .4 2.97
      PDI 504 73.167 14.311 35 95
      IDV 441 25.381 12.205 6 48
      MAS 441 47.81 12.86 21 73
      UAI 441 72.857 18.91 30 101
      LTVSSTO 735 35.771 19.051 4 71
      IVR 756 43.194 24.184 0 100
      PGat2152017PPP 497 3.576 5.754 0 43.6
      PHRat2152017PPP 497 10.779 14.507 0 84
      PGat3652017PPP 497 9.44 10.993 .1 63.1
      PHRat3652017PPP0 497 24.816 23.247 .4 95.5
      InflationGDPdeflat~l 890 7.419 8.032 -26.3 49.522
      Populationtotal 903 1.051e+08 2.651e+08 2017142 1.408e+09
      Populationrural 903 58252435 1.608e+08 831930 8.954e+08
      Ruralpopulationasa~a 903 .472 .204 .08 .859
      Populationgrowthan~l 903 1.358 1.213 -2.171 7.449
      TradeofGDP 865 65.443 29.26 20.723 166.698
      Schoolenrollmentse~y 723 73.264 25.595 9.793 141.364
      GDPgrowthadjustedf~i 903 -2.644 8.735 -49.899 21.561
      GDPgrowthannual 898 4.694 3.403 -14.1 18.287
      GDPdeflatorbaseyea~b 898 122.126 287.397 4.02 5068.098
      GDPcurrentUS 898 3.496e+11 1.212e+12 1.171e+09 1.428e+13
      Wageandsalariedwor~l 903 48.553 22.279 4.83 89.17
      Currenthealthexpen~f 859 5.754 1.987 1.853 13.677
      LevelofdemocracyPo~V 853 5.808 3.378 0 10
      Arablelandoftotal 896 19.265 15.39 1.571 64.808
      Country ID 861 449.561 272.636 8 894
      Code:
      Descriptive statistics 24 countries     
      Variable Obs Mean Std. Dev. Min Max
      Year 504 2009 6.061 1999 2019
      GLPIntensity 440 .007 .012 0 .061
      GrossLoanPortfolio 444 1.514e+09 3.244e+09 354 2.698e+10
      BorrowerIntensity 439 .022 .035 0 .17
      NumberofActiveBorr~s 439 2597524.8 6219117.3 2 39514842
      GiniIndexWorldBank 318 43.789 7.039 28.7 59
      Gini DispSWIID 486 41.799 5.671 28.1 53.2
      Gini Disp SESWIID 486 1.2 .45 .4 2.79
      PDI 504 73.167 14.311 35 95
      IDV 441 25.381 12.205 6 48
      MAS 441 47.81 12.86 21 73
      UAI 441 72.857 18.91 30 101
      LTVSSTO 378 39.667 16.426 14 69
      IVR 378 45.5 27.94 0 100
      PGat2152017PPP 318 2.384 2.581 0 15.9
      PHRat2152017PPP 318 7.681 8.435 0 46
      PGat3652017PPP 318 7.088 7.015 .1 34.6
      PHRat3652017PPP0 318 19.911 18.751 .6 81.8
      InflationGDPdeflat~l 494 7.221 8.544 -26.3 49.522
      Populationtotal 504 1.647e+08 3.417e+08 2971197 1.408e+09
      Populationrural 504 89913502 2.089e+08 1005676 8.954e+08
      Ruralpopulationasa~a 504 .404 .189 .08 .768
      Populationgrowthan~l 504 1.04 .827 -2.171 2.766
      TradeofGDP 478 63.225 29.102 20.982 166.698
      Schoolenrollmentse~y 434 79.214 20.983 22.511 141.364
      GDPgrowthadjustedf~i 504 -2.929 9.322 -49.899 21.561
      GDPgrowthannual 499 4.19 3.416 -10.894 18.287
      GDPdeflatorbaseyea~b 499 152 381.115 9.188 5068.098
      GDPcurrentUS 499 5.835e+11 1.586e+12 6.876e+09 1.428e+13
      Wageandsalariedwor~l 504 55.248 16.072 15.24 89.17
      Currenthealthexpen~f 480 5.57 2.004 1.853 10.442
      LevelofdemocracyPo~V 473 6.567 3.322 0 10
      Arablelandoftotal 497 20.436 16.04 1.571 64.808
      Country ID 483 411.696 264.135 32 890
      Last edited by Mattthew Kellan; 30 Nov 2022, 07:50.

      Comment


      • #4
        Originally posted by Carlo Lazzaro View Post
        Matt:
        interaction scenario: the number of observations and the coefficients are the same across (2) and (3): my but feeling is that it's the very same stuff.
        I have another note, Carlo; if I run my code in the EXACT same way, however minus the interaction term, results differ across (2) and (3). Very weird.

        Comment


        • #5
          Matt:
          I meant that you inadvertently pasted in columns (2) and (3) the same results twice.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Originally posted by Carlo Lazzaro View Post
            Matt:
            I meant that you inadvertently pasted in columns (2) and (3) the same results twice.
            Dear Carlo, I just did it by hand and examined the results in Stata. After having deleted the observations, the results remain the same.
            And again: if I remove the interaction term, the result in (2) and (3) differ.

            The summary statistics show me that Stata deleted observations. However, it seems like Stata 'does not understand' that and performs the same regression as in column 2.

            See hereby the results when I delete the interaction term:
            Code:
             
            (1) (2) (3)
            VARIABLES The impact of GLP on Gini - 69 countries The impact of GLP on Gini - 43 countries The impact of GLP on the Gini - 24 countries
            GLP Intensity -31.58*** -55.87*** -115.6***
            (12.06) (14.53) (13.38)
            Inflation, GDP deflator (annual %) 0.0706 0.0466 -0.0734
            (0.0585) (0.0763) (0.0487)
            Rural population, as a % of total -1.451 1.854 -15.63***
            (1.638) (2.126) (1.945)
            Population growth (annual %) 2.113*** 1.811*** 1.449***
            (0.249) (0.271) (0.255)
            Trade (% of GDP) -0.0603*** -0.0854*** 0.0219***
            (0.00739) (0.00891) (0.00659)
            School enrollment, secondary (% gross) 0.0488*** 0.0110 0.00108
            (0.0157) (0.0182) (0.0121)
            GDP growth (adjusted for inflation) 0.165*** 0.184*** 0.107**
            (0.0541) (0.0696) (0.0447)
            Wage and salaried workers, total (% of total employment) -0.0151 -0.00674 -0.316***
            (0.0162) (0.0203) (0.0186)
            Current health expenditure (% of GDP) 0.345*** 0.610*** 0.529***
            (0.111) (0.144) (0.114)
            Level of democracy (Polity V) 0.323*** 0.592*** 0.682***
            (0.0718) (0.0887) (0.0628)
            Arable land (% of total) -0.0654*** -0.114*** -0.165***
            (0.0162) (0.0194) (0.0151)
            Constant 38.50*** 39.58*** 60.30***
            (1.945) (2.405) (2.012)
            Observations 789 580 349
            Adjusted R-squared 0.237 0.343 0.784
            Standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1
            Last edited by Mattthew Kellan; 30 Nov 2022, 08:20.

            Comment


            • #7
              Matt:
              could you please share an example/excerpt of yuor dataset via -dataex-? Thanks.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Originally posted by Carlo Lazzaro View Post
                Matt:
                could you please share an example/excerpt of yuor dataset via -dataex-? Thanks.
                Of course:

                Code:
                * Example generated by -dataex-. For more info, type help dataex
                clear
                input double(GLPIntensity Gini_DispSWIID) byte IDV int UAI double(InflationGDPdeflatorannual Ruralpopulationasaoftota Populationgrowthannual TradeofGDP)
                 .00010826657407385078 40.5 46 68     .5695463703861918 .46993000018555287         1.220032           53.98669
                 .00024629969107293006 40.6 46 68    -.7422881899187672  .4666499986524817         1.181404           59.16183
                  .0004424990448828564 40.6 46 68     .6523175422961316  .4633800153902022         1.148669             59.418
                  .0009231053728108443 40.6 46 68    1.2085444903493254 .46009998721768786         1.121336           60.53409
                  .0011377897214827812 40.7 46 68    1.0626050029696472  .4568300034341872         1.107817           58.32774
                   .001821941976084357 40.7 46 68    1.2192211072938477  .4535599901126328         1.109603           61.59653
                  .0026142703396397756 40.7 46 68     1.190540613430997 .44826001082298167         1.123878           67.91485
                    .00601830811481642 40.8 46 68    1.5480307575997472 .44253999772567093         1.139825           71.49629
                   .009129199238831792 40.7 46 68    3.5950548014277643  .4368300010878051         1.158607           78.48717
                   .007529243755406918 40.7 46 68     4.530497094994075  .4311400009519036         1.190235           85.67282
                   .006591952518344188 40.7 46 68     .1469122273059611  .4254800019806392         1.236207            67.9151
                   .006124374840821668 40.7 46 68      .975621692194963 .41981998544122656         1.289207           75.24763
                    .00498547980664891 40.7 46 68    -.6909805556895492   .414190012403201         1.346583            83.4268
                   .005224710846328169 40.7 46 68     .3693352296744763  .4085800094808064         1.393575           85.12492
                   .005306943262876079 40.6 46 68    1.3072920357140845 .40299999658912666         1.415268           80.02056
                   .005190517346317712 40.6 46 68    .37780957730886655  .3974400069161653         1.403842           81.77227
                   .005598316386637676    . 46 68    2.1290482440509635  .3919100112140663         1.368821           77.19804
                   .004592114817252594    . 46 68    1.4831570050147747 .38639999221095866         1.325902            80.8606
                   .003706072773355944    . 46 68     .6349413350019546  .3809199882960852         1.286961           83.99917
                   .002426611104525132    . 46 68    1.0896339713365393  .3754699987002169         1.250763           87.97578
                                     .    . 46 68    1.3570769764593251 .37006000751375734         1.221179           87.22552
                    .00525097933588633   33 20 60    3.7810377371878587  .7679799980277923         2.022752           28.38794
                   .005392429171205332   33 20 60     3.446659349604772  .7640999972253961          1.95239           29.32171
                   .003035704915988671 33.2 20 60    3.2611601315308008  .7590400024647797         1.886286           32.09802
                   .010850175531911881 33.3 20 60    3.8928674349137538  .7524399980534138         1.820058           28.96738
                   .012749292338683972 33.5 20 60     5.815816648367033  .7493048639426324         1.731269           27.65788
                   .014762181401406468 33.7 20 60     4.562136379540348    .73729931305823           1.6152           26.85823
                    .01587613482318893 33.9 20 60     4.586360704682562  .7336255584499801         1.484747           34.39693
                   .019451222688200622   34 20 60     5.875935815353415  .7238090031536358         1.347121           38.11192
                   .021544004752294368   34 20 60    6.4712601029626455    .71498477212114         1.226631           39.94238
                   .023181695440934205 34.1 20 60     7.860966092062483  .7137701168484646         1.145647           42.62091
                   .022448966451335896 34.1 20 60     6.764354686017143  .7058430337352881         1.116806            40.0928
                   .022684421369026448 34.2 20 60     7.144663025002274  .6979481469656267         1.124807           37.80284
                    .02150137381644615 34.2 20 60     7.859450854953408  .6900103001789993         1.143829           47.42085
                    .02319102407840667 34.2 20 60     8.164573677767933  .6820933083381675         1.154006           48.11092
                   .023310869217947863 34.1 20 60     7.174953426723391  .6742540408421072         1.155951            46.2964
                    .02383600812100529 34.1 20 60     5.668788527593833  .6665916589256283          1.14293           44.51408
                   .025957694667288637 34.1 20 60     5.872777040496075  .6591734769686419         1.119091             42.086
                   .023654822052813343 34.1 20 60     27.85073772415177  .6519930214465002         1.095288           31.33415
                   .025876794464775067    . 20 60     5.047597582037142  .6387558698924681         1.075535           29.99973
                     .0203775185061874    . 20 60     5.805538767045746  .6320614548643088          1.05357           32.51463
                   .012444718196778252    . 20 60    3.6581375516217207  .6255896604209165         1.029197           31.57805
                                     . 37.9  .  .   -1.2630589388777764   .651374791955202          .865851           33.52416
                                     . 38.9  .  .    2.0627926136811396  .6415104799844771          .787957           39.41101
                1.7297297297297298e-07 39.9  .  .     2.047049457313335  .6290049927271297          .726381           38.52736
                 2.419502907075584e-07   41  .  .     .6020990780039455  .6154326772883474              .67            42.7474
                 2.664149034204868e-07 41.3  .  .    2.6031777189569283  .6022974231605092          .622861           51.80399
                1.1584069348198533e-06 41.6  .  .     6.951992680456897  .5887004995852864          .593933           59.50552
                1.4203961556800833e-06 41.8  .  .     3.903744269232874  .5745098640812445          .588125           62.20789
                1.8762950878047186e-06   42  .  .    3.9265493966458678  .5613949443944409          .558374           64.47888
                 5.911886467211591e-06 42.2  .  .     7.749686493147706  .5478474980745665          .522272           62.19336
                .000017093593379636985 42.4  .  .     7.795346036821243  .5344787888167107          .512387           57.61272
                  .0038946478189623066 42.4  .  .   -.20953336098273212  .5213106380421556          .497381           45.18487
                    .00405137538359432 42.4  .  .     6.881380253157076  .5075857532116573           .48296           50.71708
                  .0017895830253592002 42.4  .  .     8.075684466955508  .4951544011865862          .546458            50.7409
                  .0017590324530632672 41.7  .  .    2.3312175757732376 .48220707581653977          .678345           48.26752
                .000029047151584937322   41  .  .    2.1633700268356932 .47020333910389955          .666073           46.74438
                 .00009454645369760493   41  .  .     1.031063687678511 .45777265901768405          .630326           44.90522
                 .00008841060416214653 40.7  .  . -.0029440935731486206  .4449726783876625          .581456           39.46417
                 .00008933631061219766 40.6  .  .    1.4073460272495026  .4323420690450284          .573051           36.89442
                 .00008681107202040551 40.5  .  .     4.232681975266431 .42042235615574963          .605245           37.63241
                 .00002520844884417192 40.5  .  .     3.499747635690099 .40848042430636744          .467672           37.56578
                                     . 40.5  .  .    1.2867004075708905 .39708896142412153          .354741            35.8901
                                     . 43.5 48 40    3.0683955207817064   .725470000016974 1.80555973688001 24.815598044292916
                .000012709253509000833 43.7 48 40    3.6449701611281853  .7233299998723801 1.76812551036934 26.900922910070218
                .000019282919488985497 44.6 48 40     3.215616017450685   .720820000225972 1.72876856952673 25.993254753436517
                .000029558402198553475 45.4 48 40     3.715683776528138  .7175600002709918 1.68956166096073  29.50866293529817
                 .00004905318257650608 46.4 48 40    3.8677980861705947  .7142800002475163 1.65149126857663 30.592436133017536
                  .0001013611175929769 47.3 48 40     5.725413227462823  .7109700003346071 1.61530829494259  37.50381405944698
                  .0003048918897840711 47.1 48 40     5.621903262684043  .7076500002452053 1.57970914338086  42.00166961510038
                  .0004936213578101527 47.3 48 40     8.400938217139625  .7043100003310121  1.5456964390645  45.72448049905029
                  .0006360658706794038 47.4 48 40      6.94441825372725  .7009400003357478 1.50922198555755  45.68626867944124
                  .0011602695286606253 47.6 48 40     9.193969626263382  .6975400001786669 1.46488991482359 53.368220439222625
                  .0016687133363801354 47.8 48 40      7.04036543496747  .6941299999949003 1.41058271379931 46.272869643101785
                  .0027547759249562974 48.1 48 40    10.526030856185287  .6906999997698255 1.35033831370532  49.25520649748065
                  .0029508571312559196 48.6 48 40     8.733580144046144  .6872399998413485 1.28851296178524  55.62388001352977
                  .0023603750898660426 47.9 48 40     7.934386248393665  .6836600000557916 1.23148489388617 55.793721728751144
                   .002436246605174591 47.8 48 40     6.186504000834532  .6799700002682376 1.18290421490412 53.844131946677734
                  .0026837906257080294 47.6 48 40      3.33175691706154  .6761599997754864 1.14567340150608 48.922185747066905
                  .0034538266029557493 47.6 48 40    2.2795881084983307  .6722299996380879 1.11689591278599  41.92291386586472
                   .005072670249787296 47.5 48 40    3.2379749508076685  .6681799999207259 1.09045932094686  40.08248571327602
                  .0051721100729122576 47.3 48 40      3.96925793352338  .6639999998087663 1.06335942989132  40.74249695452253
                   .008211420071453483 47.2 48 40    3.8842402719666325  .6596999999296932 1.03782784787162  43.61696933238889
                   .009528281712208292 47.1 48 40     2.390748792181057  .6552799998889944 1.01326124930492 39.962527933959066
                   .006195935764744537 41.7 14 48    14.161195985779102  .5943958888780912          1.39529           62.94391
                   .005197076341798923 41.5 14 48    20.447456852145905  .5815222799009324         1.379908           71.43688
                  .0060602502820245934 41.6 14 48    14.295715436283587   .573620671151202         1.368096           69.79321
                   .007341842773981529 41.8 14 48      5.89605169318483  .5658872405723301         1.357349           59.07946
                   .007396531477348236 42.1 14 48     5.487429137901472  .5583055432210126         1.348846           53.61649
                   .008057410665130025 42.5 14 48     8.550727031863659  .5463852749060927         1.341871           59.76129
                   .008239394170056914 42.9 14 48    14.331787084271213  .5391324708050487         1.336305           63.98794
                   .009666463503679668 43.4 14 48     14.08742441679263  .5320117069437758         1.329582           56.65713
                   .009225095465934936 43.9 14 48    11.258578530897111  .5250151674515005         1.323834           54.82925
                  .0076284577199649565 44.3 14 48    18.149751249467556  .5181132498311726         1.323331            58.5614
                   .010810982760665703 44.9 14 48      8.27475243172853  .5070812131296955         1.329217           45.51212
                   .011258912826747399 45.6 14 48    15.264293657644942  .5003427430491166         1.337782           46.70127
                   .011284987154089335 46.2 14 48     7.465943033675131 .49364384994747873         1.347904           50.18001
                   .011919948883828864 46.7 14 48    3.7538787532365347  .4870161612167425           1.3517            49.5829
                 .00006981427228215367   47 14 48     4.965990291316771 .48052997007044895         1.340771           48.63737
                 .00010982095833590589 47.2 14 48     5.443174549356115 .47427159682731274         1.310945           48.08018
                end

                Comment


                • #9
                  Matt:
                  have you already ruled out that the culprit is a set of missing values?
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    I have another note, Carlo; if I run my code in the EXACT same way, however minus the interaction term, results differ across (2) and (3). Very weird.
                    It is clear that in the regressions with the interaction terms, observations are being removed which are not being removed in the regressions without the interaction terms.

                    In the former, the Ns are 324, 309, and 309.

                    In the latter, the Ns are 782, 583, and 392.

                    So I think that in actuality, the observations *used by the regression* are identical in the 2nd and 3rd models with the interaction terms.

                    Your reports of the descriptive statistics are misleading because they omit the number of observations, which should be the number of non-missing values. Adjust your asdoc command suitably and you will see this.

                    With that said, in any event dropping observations by observation number is not a good idea. Do you understand that in the code
                    Code:
                    // Timor-East has no CountryID, so we have to drop it in another way.
                    drop if Country_ID==204
                    drop if Country_ID==120
                    ...
                    drop if Country_ID==810
                    drop in 442/462
                    that if observations for Timor-East are number 442 to 462 before any observations are dropped, once you drop the observations from any country earlier in the dataset, Timor-East will no longer be observations 442/462?

                    If the Country_ID is missing for Timor-East, you would be better off identifying those observations in your original dataset (just after running the kountry command, before any country is droppped) and the manually assigning a country code at that point.
                    Code:
                    assert missing(Country_ID) in 442/462
                    replace Country_ID = 1001 in 442/462
                    and then later using that value of Country_ID to drop Timor-East.

                    And follow the same procedure for North Macedonia. I am surprised that exactly the same observation numbers are dropped for North Macedonia as for Timor East.

                    Comment


                    • #11
                      Originally posted by Carlo Lazzaro View Post
                      Matt:
                      have you already ruled out that the culprit is a set of missing values?
                      Dear Carlo,
                      Could you explain to me how to rule that out? I do not know that much about Stata, but I am trying

                      Comment


                      • #12
                        Originally posted by William Lisowski View Post

                        It is clear that in the regressions with the interaction terms, observations are being removed which are not being removed in the regressions without the interaction terms.

                        In the former, the Ns are 324, 309, and 309.

                        In the latter, the Ns are 782, 583, and 392.

                        So I think that in actuality, the observations *used by the regression* are identical in the 2nd and 3rd models with the interaction terms.

                        Your reports of the descriptive statistics are misleading because they omit the number of observations, which should be the number of non-missing values. Adjust your asdoc command suitably and you will see this.

                        With that said, in any event dropping observations by observation number is not a good idea. Do you understand that in the code
                        Code:
                        // Timor-East has no CountryID, so we have to drop it in another way.
                        drop if Country_ID==204
                        drop if Country_ID==120
                        ...
                        drop if Country_ID==810
                        drop in 442/462
                        that if observations for Timor-East are number 442 to 462 before any observations are dropped, once you drop the observations from any country earlier in the dataset, Timor-East will no longer be observations 442/462?

                        If the Country_ID is missing for Timor-East, you would be better off identifying those observations in your original dataset (just after running the kountry command, before any country is droppped) and the manually assigning a country code at that point.
                        Code:
                        assert missing(Country_ID) in 442/462
                        replace Country_ID = 1001 in 442/462
                        and then later using that value of Country_ID to drop Timor-East.

                        And follow the same procedure for North Macedonia. I am surprised that exactly the same observation numbers are dropped for North Macedonia as for Timor East.
                        Dear William,

                        Thank you for your elaborate response.

                        I was aware of the fact that it is not optimal to drop a country like that, however I did not know any other solution. Now, I have adjusted my code thanks to you. This makes it more fault-proof. Thanks for that!

                        Moreover, I have adjusted my asdoc commands as follows:
                        Code:
                        asdoc sum, save(Descriptives 24 countries) dec(3) title(Descriptive statistics 24 countries) statistics(count mean sd min max) replace
                        The N's still seem to differ, as you can see below. So, would the culprit then be the missing values..?

                        Code:
                        Descriptive statistics 24 countries   
                        N Mean SD Min Max
                        Year 504 2009 6.061 1999 2019
                        GLPIntensity 440 .007 0.012 0 .061
                        GrossLoanPortfolio 444 1.514e+09 3244022840.518 354 2.698e+10
                        BorrowerIntensity 439 .022 0.035 0 .17
                        NumberofActiveBorr~s 439 2597524.8 6219117.303 2 39514842
                        GiniIndexWorldBank 318 43.789 7.039 28.7 59
                        Gini DispSWIID 486 41.799 5.671 28.1 53.2
                        Gini Disp SESWIID 486 1.2 0.450 .4 2.79
                        PDI 504 73.167 14.311 35 95
                        IDV 441 25.381 12.205 6 48
                        MAS 441 47.81 12.860 21 73
                        UAI 441 72.857 18.910 30 101
                        LTVSSTO 378 39.667 16.426 14 69
                        IVR 378 45.5 27.940 0 100
                        PGat2152017PPP 318 2.384 2.581 0 15.9
                        PHRat2152017PPP 318 7.681 8.435 0 46
                        PGat3652017PPP 318 7.088 7.015 .1 34.6
                        PHRat3652017PPP0 318 19.911 18.751 .6 81.8
                        InflationGDPdeflat~l 494 7.221 8.544 -26.3 49.522
                        Populationtotal 504 1.647e+08 341690879.439 2971197 1.408e+09
                        Populationrural 504 89913502 208880968.123 1005676 8.954e+08
                        Ruralpopulationasa~a 504 .404 0.189 .08 .768
                        Populationgrowthan~l 504 1.04 0.827 -2.171 2.766
                        TradeofGDP 478 63.225 29.102 20.982 166.698
                        Schoolenrollmentse~y 434 79.214 20.983 22.511 141.364
                        GDPgrowthadjustedf~i 504 -2.929 9.322 -49.899 21.561
                        GDPgrowthannual 499 4.19 3.416 -10.894 18.287
                        GDPdeflatorbaseyea~b 499 152 381.115 9.188 5068.098
                        GDPcurrentUS 499 5.835e+11 1.586e+12 6.876e+09 1.428e+13
                        Wageandsalariedwor~l 504 55.248 16.072 15.24 89.17
                        Currenthealthexpen~f 480 5.57 2.004 1.853 10.442
                        LevelofdemocracyPo~V 473 6.567 3.322 0 10
                        Arablelandoftotal 497 20.436 16.040 1.571 64.808
                        Country ID 483 411.696 264.135 32 890
                        Descriptive statistics 43 countries
                        N Mean SD Min Max
                        Year 903 2009 6.059 1999 2019
                        GLPIntensity 806 .009 0.015 0 .193
                        GrossLoanPortfolio 810 9.327e+08 2506500899.582 354 2.698e+10
                        BorrowerIntensity 805 .019 0.029 0 .17
                        NumberofActiveBorr~s 805 1529358 4744804.907 2 39514842
                        GiniIndexWorldBank 497 41.571 8.013 25.7 64.8
                        Gini DispSWIID 854 41.769 6.418 28.1 63.1
                        Gini Disp SESWIID 854 1.419 0.542 .4 2.97
                        PDI 504 73.167 14.311 35 95
                        IDV 441 25.381 12.205 6 48
                        MAS 441 47.81 12.860 21 73
                        UAI 441 72.857 18.910 30 101
                        LTVSSTO 735 35.771 19.051 4 71
                        IVR 756 43.194 24.184 0 100
                        PGat2152017PPP 497 3.576 5.754 0 43.6
                        PHRat2152017PPP 497 10.779 14.507 0 84
                        PGat3652017PPP 497 9.44 10.993 .1 63.1
                        PHRat3652017PPP0 497 24.816 23.247 .4 95.5
                        InflationGDPdeflat~l 890 7.419 8.032 -26.3 49.522
                        Populationtotal 903 1.051e+08 265137273.313 2017142 1.408e+09
                        Populationrural 903 58252435 160834418.109 831930 8.954e+08
                        Ruralpopulationasa~a 903 .472 0.204 .08 .859
                        Populationgrowthan~l 903 1.358 1.213 -2.171 7.449
                        TradeofGDP 865 65.443 29.260 20.723 166.698
                        Schoolenrollmentse~y 723 73.264 25.595 9.793 141.364
                        GDPgrowthadjustedf~i 903 -2.644 8.735 -49.899 21.561
                        GDPgrowthannual 898 4.694 3.403 -14.1 18.287
                        GDPdeflatorbaseyea~b 898 122.126 287.397 4.02 5068.098
                        GDPcurrentUS 898 3.496e+11 1.212e+12 1.171e+09 1.428e+13
                        Wageandsalariedwor~l 903 48.553 22.279 4.83 89.17
                        Currenthealthexpen~f 859 5.754 1.987 1.853 13.677
                        LevelofdemocracyPo~V 853 5.808 3.378 0 10
                        Arablelandoftotal 896 19.265 15.390 1.571 64.808
                        Country ID 882 462.714 282.241 8 1002

                        Comment


                        • #13
                          Matt:
                          you may want to consider the -egen- function -rowmiss-:
                          Code:
                          . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
                          (1978 automobile data)
                          
                          . egen wanted=rowmiss( make- foreign )
                          
                          . list price mpg rep78 headroom foreign wanted in 1/10
                          
                               +-----------------------------------------------------+
                               |  price   mpg   rep78   headroom    foreign   wanted |
                               |-----------------------------------------------------|
                            1. |  4,099    22       3        2.5   Domestic        0 |
                            2. |  4,749    17       3        3.0   Domestic        0 |
                            3. |  3,799    22       .        3.0   Domestic        1 |
                            4. |  4,816    20       3        4.5   Domestic        0 |
                            5. |  7,827    15       4        4.0   Domestic        0 |
                               |-----------------------------------------------------|
                            6. |  5,788    18       3        4.0   Domestic        0 |
                            7. |  4,453    26       .        3.0   Domestic        1 |
                            8. |  5,189    20       3        2.0   Domestic        0 |
                            9. | 10,372    16       3        3.5   Domestic        0 |
                           10. |  4,082    19       3        3.5   Domestic        0 |
                               +-----------------------------------------------------+
                          
                          .
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            My sense is that you are ending up running the regressions on identical data when you include the interaction term. When you go from 43 to 24, you say this is because you "drop the countries for which we don't have PDI/IDV/MAS/UAI data". Now in the regressions with interaction terms, you have MAS and the interaction of MAS with GLPintensity. If MAS is anyway missing for the 19 countries you dropped, then even when those countries were included in the 43 sample, they would not have been used in the regression. You can also see in your descriptive stats, that when you go from 43 to 24 countries, the number of non-missing observations for MAS does not change -- it remains 441. Since this variable is not used in your other set of regressions (the ones without interaction terms), their effective observations actually do change across the two samples (i.e. with 43 and 24 countries, respectively). This is why the issue comes up in the regressions with the interaction terms but not in those without.

                            One way to check this is the following -- after running your regression with interaction terms on 43 countries, run this code:
                            Code:
                            gen byte to_drop = inlist(Country_ID,8,51,854,214,818,231,268,288,400,417,466,498,566,646,710,834,800,894)
                            replace to_drop = 1 in 442/462
                            assert missing(MAS) if to_drop
                            If the assertion goes through, case closed.
                            Last edited by Hemanshu Kumar; 30 Nov 2022, 12:40.

                            Comment


                            • #15
                              Originally posted by Hemanshu Kumar View Post
                              My sense is that you are ending up running the regressions on identical data when you include the interaction term. When you go from 43 to 24, you say this is because you "drop the countries for which we don't have PDI/IDV/MAS/UAI data". Now in the regressions with interaction terms, you have MAS and the interaction of MAS with GLPintensity. If MAS is anyway missing for the 19 countries you dropped, then even when those countries were included in the 43 sample, they would not have been used in the regression. You can also see in your descriptive stats, that when you go from 43 to 24 countries, the number of non-missing observations for MAS does not change -- it remains 441. Since this variable is not used in your other set of regressions (the ones without interaction terms), their effective observations actually do change across the two samples (i.e. with 43 and 24 countries, respectively). This is why the issue comes up in the regressions with the interaction terms but not in those without.

                              One way to check this is the following -- after running your regression with interaction terms on 43 countries, run this code:
                              Code:
                              gen byte to_drop = inlist(Country_ID,8,51,854,214,818,231,268,288,400,417,466,498,566,646,710,834,800,894)
                              replace to_drop = 1 in 442/462
                              assert missing(MAS) if to_drop
                              If the assertion goes through, case closed.
                              Thank you so much for your response. This is indeed the solution. I knew right away when reading the post!
                              Whilst I was typing my response, I saw that you edited your post. I implemented the piece of code you provided and the assertion went through.
                              Case closed.

                              Cheers!

                              Comment

                              Working...
                              X