I try to figure out the equivalent of my ppml command to ppmlhdfe command, including exporter-time, importer-time and pair fixed effects.
I try to estimate the impact of a customs union on a country's trade. For this purpose, I use structural gravity model. My dataset includes 25 years of bilateral trade flows of countries. A sample of my dataset is as following.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year str44(importer exporter) float tot_trade byte(contiguity agree_pta_goods) double distance byte common_language double(colony_history ex_cu im_cu ln_DIST) byte pick_2 1994 "Ecuador" "France" 58677.68 0 0 9461.1875 0 0 0 0 9.154953182709102 1 1997 "Dem. Rep. of the Congo" "Peru" 703.819 0 0 10632.649 0 0 0 0 9.271684640667031 1 1999 "Bolivia (Plurinational State of)" "Slovenia" 264.175 0 0 10663.994 0 0 0 0 9.274628299217726 1 2002 "Gambia" "Thailand" 4807.716 0 0 12452.279 1 0 0 0 9.429658937349679 1 2004 "Bahamas" "Colombia" 44224.74 0 0 2164.2061 0 0 0 0 7.679808875727051 1 2009 "Ecuador" "Guatemala" 9768.951 0 0 2200.6453 1 0 0 0 7.696505914518857 1 2014 "Belarus" "Saint Vincent and the Grenadines" .4 0 0 8778.5654 0 0 0 0 9.080068279201447 1 2015 "Grenada" "South Africa" 198.094 0 0 10511.784 1 0 0 0 9.260252192568075 1 2015 "Cambodia" "Italy" 60636.74 0 0 9329.0723 1 0 0 0 9.140890856957729 1 2015 "Rep. of Moldova" "Slovakia" 27215.846 0 1 768.47858 0 0 0 0 6.644412690111351 1 end
I have used ols and ppml so far but I experienced convergence issues with ppml. Then I noticed that ppmlhdfe command is suggested in the forum, then I decided to try it. However, I could not figure out the exact equivalent of my ppml command.
Firstly, my ppml command is as following. I employ, exporter-time, importer-time and pair fixed effects.
Code:
egen exp_time = group(exporter year) quietly tabulate exp_time, gen(EXPORTER_TIME_FE) egen imp_time = group(importer year) quietly tabulate imp_time, gen(IMPORTER_TIME_FE) egen pair_id = group(exporter importer) ppml tot_trade EXPORTER_TIME_FE* IMPORTER_TIME_FE* ln_DIST contiguity agree_pta_goods common_language colony_history ex_cu im_cu, cluster(pair_id) * I used example codes of Yotov et al. (2016) An advanced guide to trade policy analysis: The structural gravity model. Geneva: World Trade Organization
Variables are :
-tot_trade: exports from country a to b
-EXPORTER_TIME_FE: exporter time fixed effect
-IMPORTER_TIME_FE: importer time fixed effect
-ln_DIST: natural log of distance
-contiguity, agree_pta_goods, common_language,colony_history are dummy variables to control for related indicators.
-ex_cu: dummy variable, 1 if the trade flow is exports from the examined country to the customs union after the establishment of the customs union, or zero otherwise.
-im_cu: dummy variable, 1 if the trade flow is imports from the customs union to the examined country after the establishment of the customs union, or zero otherwise.
-pair_id: pair fixed effect
I wrote the following ppmlhdfe command by looking the help file but I am not so experienced, I just tried.
Code:
ppmlhdfe tot_trade ln_DIST contiguity agree_pta_goods common_language colony_history ex_cu im_cu, absorb (i.exporter#i.year i.importer#i.year) cluster(i.importer#i.exporter)
Then I received the following error:
Code:
importer: string variables may not be used as factor variables
Kind regards
0 Response to Using ppmlhdfe with exporter-time, importer-time and pair fixed effects - Gravity model
Post a Comment