Please read attached picture 1,2,3 and 4 to understand my queries. I will be very grateful for your comments.
Example 1 of 1: I want to run ppml estimator on the data given in Table 1 to get the results as given in Table 2 and Table 3.
Are the following Stata commands, correct? Total exporting countries are 10 and importing countries are
200 and years (time periods) are 25. Column 1 (Exporter) and Column 2 (Importer) are Country IDs.
Step 1
egen exp_time = group(exporter year)
quietly tabulate exp_time, generate(EXPORTER_TIME_FE)
egen imp_time = group(importer year)
quietly tabulate imp_time, generate(IMPORTER_TIME_FE)
egen pair_id = group(exporter importer)
quietly tabulate pair_id, generate(PAIR_FE)
Step 2: For Table 2 Desired Output
ppml trade gdp_e gdp_i fta lang, a(i.exporter i.importer) cluster(pair_id)
or
ppmlhdfe trade gdp_e gdp_i fta lang, a(i.exporter i.importer) cluster(pair_id)
Step 2: For Table 3 Results
ppml trade pta, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe trade pta, a(exp_time imp_time pair_id) cluster(pair_id)
Example 2 of 2: Continuing from Example 1, now I want to check the impact of trade agreement characteristics impact on bilateral trade. Trade agreements are evaluated on three types of characteristics, i.e., depth, flexibility and constraints as given in Table 4. To proceed with the analysis, first, I need to merge the data from Table 4 to Table 1A and am confused about how to do it correctly. Second, I want to check the lag and lead effect of trade agreements characteristics on trade.
How to merge these with the help of Stata commands correctly?
I adopted the following approach to merge the data.
Step 1: Sort Variables
sort exporter importer year
by exporter (importer year): gen lag3 = trade[_n-3]
by exporter (importer year): gen lag5 = trade[_n-5]
by exporter (importer year): gen lead5 = trade[_n+5]
Is this the right way to do it?
After applying the above commands, the exporter, importer and year columns look like this. I am confused about the last three columns how to post data correctly from Table 4 to Table 1A. Option 1, Option 2 or Option 3 or Option is the correct way. Or if there is any other way to deal with it correctly? An fta signed between 2 countries in a specific year (one time event) has been rated with certain scores, how it will be report for the next years in panel data and multilateral agreements?
Step 2: Get ppml estimations
ppml trade depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe trade depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
Step 3: Get lag and lead estimations
ppml lag3 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppml lag5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppml lead5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe lag3 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppmlhdfe lag5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppmlhdfe lead5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)



Example 1 of 1: I want to run ppml estimator on the data given in Table 1 to get the results as given in Table 2 and Table 3.
Are the following Stata commands, correct? Total exporting countries are 10 and importing countries are
200 and years (time periods) are 25. Column 1 (Exporter) and Column 2 (Importer) are Country IDs.
Step 1
egen exp_time = group(exporter year)
quietly tabulate exp_time, generate(EXPORTER_TIME_FE)
egen imp_time = group(importer year)
quietly tabulate imp_time, generate(IMPORTER_TIME_FE)
egen pair_id = group(exporter importer)
quietly tabulate pair_id, generate(PAIR_FE)
Step 2: For Table 2 Desired Output
ppml trade gdp_e gdp_i fta lang, a(i.exporter i.importer) cluster(pair_id)
or
ppmlhdfe trade gdp_e gdp_i fta lang, a(i.exporter i.importer) cluster(pair_id)
Step 2: For Table 3 Results
ppml trade pta, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe trade pta, a(exp_time imp_time pair_id) cluster(pair_id)
Example 2 of 2: Continuing from Example 1, now I want to check the impact of trade agreement characteristics impact on bilateral trade. Trade agreements are evaluated on three types of characteristics, i.e., depth, flexibility and constraints as given in Table 4. To proceed with the analysis, first, I need to merge the data from Table 4 to Table 1A and am confused about how to do it correctly. Second, I want to check the lag and lead effect of trade agreements characteristics on trade.
How to merge these with the help of Stata commands correctly?
I adopted the following approach to merge the data.
Step 1: Sort Variables
sort exporter importer year
by exporter (importer year): gen lag3 = trade[_n-3]
by exporter (importer year): gen lag5 = trade[_n-5]
by exporter (importer year): gen lead5 = trade[_n+5]
Is this the right way to do it?
After applying the above commands, the exporter, importer and year columns look like this. I am confused about the last three columns how to post data correctly from Table 4 to Table 1A. Option 1, Option 2 or Option 3 or Option is the correct way. Or if there is any other way to deal with it correctly? An fta signed between 2 countries in a specific year (one time event) has been rated with certain scores, how it will be report for the next years in panel data and multilateral agreements?
Step 2: Get ppml estimations
ppml trade depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe trade depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
Step 3: Get lag and lead estimations
ppml lag3 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppml lag5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppml lead5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
or
ppmlhdfe lag3 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppmlhdfe lag5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
ppmlhdfe lead5 depth flexibility constraints, a(exp_time imp_time pair_id) cluster(pair_id)
Comment