Announcement

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

  • #16
    You want the origin and destination fixed effects to vary by year. So, the right way to include the fixed effects is
    Code:
     
     ppmlhdfe FDIflow lnvreer lnreer lngdp_o lngdp_d lngdpcap_o lngdpcap_d, absorb(isonum_o##year isonum_d##year pair_id) cluster(pair_id)

    Comment


    • #17
      Dear Joao,

      Thank you for your quick reply.

      When I type the code
      Code:
      ppmlhdfe FDIflow lnvreer lnreer lngdp_o lngdp_d lngdpcap_o lngdpcap_d, absorb(isonum_o##year isonum_d##year pair_id) cluster(pair_id)
      it omits all of the variables in my model.

      Click image for larger version

Name:	Screenshot.png
Views:	1
Size:	362.7 KB
ID:	1759223

      How should I proceed?

      Comment


      • #18
        Then you need to rethink the specification of your model and think about which fixed effects you need to include.

        Comment


        • #19
          Dear Dr Santos Silva,

          I am wondering whether there are any standard diagnostic tests I should run before gravity modelling.

          I know with OLS regressions, researchers usually test for heteroscedasticity, but the PPML estimator is robust to this, and can work with zeroes in the data too. Are there any other tests that should be run before I can trust my model? I am just using the PPML estimator, hence I do not believe a RESET test is appropriate. Please see below for my regression inputs for my main model.

          Code:
          ppmlhdfe FDIflow lnvreer lnreer lngdp_o lngdp_d lngdpcap_o lngdpcap_d, absorb(pair_id year) cluster(pair_id)
          I am using the same regressors as before, but I am including country-pair/dyadic fixed effects to capture unobserved heterogeneity, as suggested by Baier, 2020 (from "Foreign Direct Investment and Tax: OECD Gravity Modelling in a World with International Financial Institutions"). My supervisor says this is appropriate.

          Please see attached for my regression outputs. My r squared is high, and GDP and GDP per capita coefficients conform to what other researchers have found (economic mass increases FDI, GDP per capita decreases FDI possibly due to wages making costs higher, albeit these are not statistically significant), so I feel somewhat confident in my results.

          Any help would be much appreciated.

          Best,

          Ronan

          Click image for larger version

Name:	Results.png
Views:	1
Size:	1,014.5 KB
ID:	1760742

          Comment


          • #20
            Dear Ronan Moore,

            You can use the RESET; that is a functional form test can can always be used. It is not a test to choose between estimators.

            Please ignore the value of the psueudo-R2 reported by reghdfe; it is meaningless and will change if you change the scale of your data!

            Best wishes,

            Joao

            Comment


            • #21
              Thank you for your response Joao Santos Silva.

              Firstly, is the RESET test then the only test I would need before running the regressions?

              Secondly, is this the correct way to conduct the RESET test:

              Code:
              ppmlhdfe FDIflow lnvreer lnreer lngdp_o lngdp_d lngdpcap_o lngdpcap_d, absorb(pair_id year) cluster(pair_id)
              Code:
              predict fit, xb
              Code:
              gen fit2 = fit^2
              Code:
              ppmlhdfe FDIflow lnvreer lnreer lngdp_o lngdp_d lngdpcap_o lngdpcap_d fit2, absorb(pair_id year) cluster(pair_id)
              Code:
              test fit2
              I don't know if using the ppmlhdfe command changes how the RESET test is performed.

              I appreciate all your help, and many thanks,

              Ronan

              Comment


              • #22
                Dear Ronan Moore,

                The RESET test is the only test I would use and that is the way to do it (notice that you are excluding the fixed effects from the fitter values, as you probably should).

                Best wishes,

                Joao

                Comment


                • #23
                  Dear Joao Santos Silva,

                  Thanks for your help, it has been invaluable.

                  All the best,

                  Ronan

                  Comment


                  • #24
                    How to create a panel dataset for many countries

                    Today, 05:57
                    Good day Joao Santos Silva
                    I am trying to consolidate data such that it includes a panel for 167 countries spanning over 10 years. Currently my dataset looks like this: It is a cross- section from 2022 and now I want to add more years.



                    COUNTRY EXPORTS in Rands GDP COMMON LANGUAGE DISTANCE COMMON TRADE AGREEMENT
                    Albania 18033154 18882095518 0 7508.121 0
                    Algeria 311870645 1.91913E+11 0 7433.072 1
                    Andorra 984554 3352032737 0 8066.814 0
                    Angola 7103356514 1.06714E+11 0 2457.726 1
                    Antigua And Barbuda 73310741 1757603704 1 10827.07 0
                    Argentina 2661167090 6.3277E+11 0 8128.39 1
                    Australia 13556646697 1.67542E+12 0 10819.277 1
                    Austria 1553215967 4.714E+11 0 8307.222 1
                    Azerbaijan 22763093 78721058824 0 7692.677 0
                    Bahamas 128302349 12897400000 1 12949.423 0
                    Bahrain 454140280 44390820479 0 6257.082 0
                    Bangladesh 3257978709 4.60201E+11 0 8660.339 0
                    Barbados 48084586 5637914515 1 10419.534 0
                    Belarus 30394551 72793457588 0 8863.57 1
                    Belgium 64095660699 5.78604E+11 0 8830.881 1
                    Belize 49764521 2824081836 1 13482.016 0
                    Benin 306942294 17401746309 0 4526.227 0
                    Bermuda 4003905 7550500000 1 11758.822 0
                    Bolivia, Plurinational State Of 71640241 43068885673 0 9763.319 0
                    Bosnia And Herzegovina 17198620 24527507288 0 7803.429 0
                    Botswana 76162711968 20352322157 1 259.274 1
                    Brazil 8265838262 1.9201E+12 0 7890.824 1
                    Brunei Darussalam 11294520 16681531646 0 9921.892 0
                    Bulgaria 864372616 89040398406 0 7628.001 0
                    Burkina Faso 586496839 18884619613 0 5319.844 1
                    Burundi 136030478 3073414678 1 2488.34 1
                    Cambodia 143461086 29956769529 0 9266.818 0
                    Cameroon 969011758 44341646509 1 3750.24 1
                    Canada 7463645422 2.13984E+12 1 13779.723 0
                    Cape Verde 65188074 2314816792 0 7192.549 1
                    Central African Republic 19232657 2382618615 0 3559.658 1
                    Chad 77490224 12704149842 0 4442.685 1
                    Chile 1051933757 3.01025E+11 0 9213.617 0
                    China 1.88588E+11 1.79632E+13 0 11662.891 1
                    Colombia 763971622 3.43939E+11 0 11460.697 0
                    Comoros 46925887 1242519407 0 2221.312 1
                    Congo 1812787119 14615532210 0 2750.109 0
                    Costa Rica 168820118 68380838316 0 12708.63 0
                    Côte D'ivoire 2193355868 70018715017 0 5194.605 1
                    Croatia 753011351 70964606465 0 8050.302 0
                    Cyprus 138108157 28439052741 0 6794.942 1
                    Czech Republic 7824643394 2.90924E+11 0 8540.823 1
                    Democratic Republic Of Congo 23639342872 58065953573 0 2750.109 1
                    Denmark 5885909709 3.95404E+11 1 9174.017 1
                    Djibouti 793271495 3515109075 0 4467.681 1
                    Dominica 5602207 612048148.1 1 10697.733 0
                    Dominican Republic 244097425 1.13642E+11 0 11667.747 0
                    Ecuador 257248673 1.15049E+11 0 11664.704 0
                    Egypt 1651230434 4.76748E+11 0 6213.199 1
                    El Salvador 15087753 32488720000 0 14413.854 0
                    Equatorial Guinea 25406898 11813908448 0 3890.369 1
                    Estonia 218675194 38100812959 0 9476.956 1
                    Eswatini 25411428723 4854167638 1 301.844 1
                    Ethiopia 501417810 1.26783E+11 0 4027.01 1
                    Fiji 43029581 4943248200 1 15080.706 0
                    Finland 1890736376 2.80826E+11 0 9557.583 1
                    France 13152259652 2.78291E+12 0 8683.484 1
                    Gabon 793206497 21071739228 0 3534.033 1
                    Gambia 72185041 2273060863 1 6516.727 1
                    Georgia 122257832 24605375420 0 7691.117 0
                    Germany 1.62875E+11 4.07219E+12 0 8820.487 1
                    Ghana 6815726226 72838798788 1 4635.802 1
                    Greece 1462110378 2.19066E+11 0 7100.949 1
                    Grenada 130715243 1256413185 1 10579.587 0
                    Guatemala 182813499 95003333381 0 13554.371 0
                    Guinea 1000393586 21227749389 0 5990.452 1
                    Guinea-Bissau 11356488 1633559092 0 6318.17 0
                    Guyana 339935396 15357537068 1 9678.316 0
                    Haiti 65228961 20253551885 0 12820.991 0
                    Honduras 278810075 31717700115 0 13199.127 0
                    Hungary 920738213 1.78789E+11 1 8195.468 1
                    Iceland 38675699 27841648044 1 10893.743 1
                    India 89547581942 3.38509E+12 1 7998.458 1
                    Indonesia 9259694519 1.3191E+12 1 8570.944 0
                    Iraq 844158776 2.64182E+11 0 6786.955 0
                    Ireland 2671510353 5.29245E+11 1 9401.419 1
                    Israel 5952168184 5.22033E+11 1 6438.362 0
                    Italy 28183121000 2.01043E+12 0 7692.556 1
                    Jamaica 109847800 17097760745 1 12323.241 0
                    Japan 1.39338E+11 4.23114E+12 0 13514.04 0
                    Jordan 715323339 47451499859 1 6466.504 0
                    Kazakhstan 368073794 2.20623E+11 1 9543.059 1
                    Kenya 8763707335 1.1342E+11 1 2872.888 1
                    Kiribati 1393878 223352943.2 1 15387.563 0
                    Kuwait 1721955690 1.84558E+11 1 6482.127 0
                    Latvia 1686151075 41153912663 0 9202.588 1
                    Lesotho 23577537659 2553459763 1 400.891 1
                    Liberia 707931072 4001047150 1 5513.672 0
                    Libya 68285395 45752336036 0 6709.932 0
                    Lithuania 296933128 70334299008 0 8947.966 1
                    Luxembourg 331856561 82274812251 1 8658.623 1
                    Madagascar 4883846640 14954967604 0 2636.045 1
                    Malawi 7593809571 13164667627 1 1431.91 1
                    Malaysia 12694094439 4.06306E+11 0 8520.317 0
                    Maldives 234855290 6189865408 1 5907.455 0
                    Mali 1422869499 18827176532 0 13504.013 0
                    Malta 660806275 17765270015 1 16946.106 1
                    Marshall Islands 378660751 279667900 0 15570.338 0
                    Mauritania 411701565 10375460680 0 6843.529 1
                    Mauritius 10420086889 12898307089 1 3056.779 1
                    Mexico 5593750222 1.41419E+12 0 14594.201 0
                    Moldova, Republic Of 7753004 14420947884 0 8090.761 0
                    Mongolia 30134848 16810883361 0 11318.706 0
                    Montenegro 29353319 6095978868 0 7638.997 0
                    Morocco 6607700799 1.34182E+11 1 6949.209 1
                    Mozambique 95334516809 17851491428 0 440.203 1
                    Namibia 56690962106 12607436976 1 1180.197 1
                    Nepal 17127595 40828247302 0 8522.878 0
                    Netherlands 97202444927 9.91115E+11 0 8976.722 1
                    New Zealand 1316062702 2.47234E+11 1 11804.102 0
                    Nicaragua 52298379 15671583878 1 13023.733 0
                    Niger 203098231 13969605583 0 5198.525 1
                    Nigeria 7669460504 4.77386E+11 1 4470.849 1
                    Norway 3198992231 5.79267E+11 0 9657.164 1
                    Oman 829265584 1.14667E+11 1 6389.123 0
                    Pakistan 12143720136 3.76533E+11 0 7954.77 0
                    Panama 712923356 76522511781 1 12206.933 0
                    Papua New Guinea 221874265 30633444295 1 12349.272 0
                    Paraguay 122997796 41722295362 0 9315.469 1
                    Peru 557327118 2.42632E+11 0 10904.626 0
                    Philippines 866798367 4.04284E+11 0 10977.222 0
                    Poland 7844820757 6.88177E+11 0 8698.244 1
                    Portugal 3411928655 2.51945E+11 0 8150.507 1
                    Puerto Rico 30041951 1.13435E+11 1 11300.015 0
                    Qatar 1555367778 2.37296E+11 1 6203.228 0
                    Romania 1837330405 3.01262E+11 0 7807.76 1
                    Russian Federation 4620441232 2.24042E+12 1 9106.279 1
                    Rwanda 487418604 13312796765 1 2653.019 1
                    Samoa 4955051 832421565.4 1 15112.584 0
                    Sao Tome And Principe 20228769 546680341.6 0 3703.394 1
                    Saudi Arabia 6599010139 1.10815E+12 0 5948.835 0
                    Senegal 2804438657 27684430244 0 6681.492 1
                    Serbia 30263449 63501748652 0 7883.528 0
                    Seychelles 1093579861 1588406479 1 3734.108 1
                    Sierra Leone 1081709447 3970343852 1 5877.625 1
                    Singapore 10178784069 4.66789E+11 1 8638.189 0
                    Sint Maarten (Dutch Part) 4224751 1571564246 1 10984.599 0
                    Slovakia 46392889 1.15469E+11 0 8290.479 1
                    Slovenia 2221693879 62117768015 0 8102.122 1
                    Solomon Islands 10577947 1595710784 1 13495.838 0
                    Somalia 164906705 8126105600 0 3602.215 0
                    Spain 22745164258 1.39751E+12 0 8061.795 1
                    Sri Lanka 4067384155 74403578363 1 6654.737 0
                    Sudan 269777992 51662241775 1 4621.266 0
                    Suriname 75883561 3620655116 1 9627.073 0
                    Sweden 2306887563 5.85939E+11 0 9505.625 1
                    Switzerland 8948072361 8.07706E+11 1 8347.091 0
                    Tajikistan 12190106 10492123388 0 8305.449 0
                    Tanzania 8835266790 75709289056 1 2227.793 1
                    Thailand 6656361251 4.95341E+11 1 8967.648 0
                    Timor-Leste 160000 3163324631 0 10323.734 0
                    Togo 1069901485 8126439481 0 4586.043 1
                    Trinidad And Tobago 62686761 27899082337 1 10486.582 0
                    Tunisia 228203226 46664948952 0 7205.417 1
                    Turks And Caicos Islands 748956 1138808881 1 11913.599 0
                    Tuvalu 3112498 60349391.1 1 15080.706 0
                    Uganda 1797996554 45559202049 1 2935.536 1
                    Ukraine 465776155 1.60503E+11 0 8475.71 0
                    United Arab Emirates 40930706404 5.07535E+11 0 6253.514 0
                    United Kingdom 1.02427E+11 3.07067E+12 1 9024.146 1
                    United States 1.77895E+11 2.54627E+13 1 12821.458 1
                    Uruguay 565458783 71177146197 0 8572.563 1
                    Uzbekistan 12366231 80391853885 0 8572.563 0
                    Vanuatu 10234329 983582864.6 1 13536.572 0
                    Viet Nam 5260492606 4.08802E+11 1 9854.74 0
                    Zambia 44313062268 29784454056 1 1148.828 1
                    Zimbabwe 52473837750 20678055598 1 929.143 1

                    Comment


                    • #25
                      Dear Rethabile Molapo,

                      I am afraid I do not understand your question and, in any case, I am not the best person to advise you on data manipulation issues.

                      Best wishes,

                      Joao

                      Comment

                      Working...
                      X