Dear all,

I am a bit confused and I would be happy to get some suggestions. Here is the problem. I want to perform a standard panel gravity model of international trade, where the dependent variable is the average value of exports between two countries. I also have exporter and importer specific variables, such as GDP, area, population and so on. An extract of the dataset for UK and Italy and for some variables is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str3(iso3_o iso3_d) int year byte(contig comlang_off) double(distw pop_o pop_d gdp_o gdp_d) long(area_o area_d) byte(colony comcur) float comrelig byte(fta_wto eu_o eu_d) str52(country_o country_d) str6 newid float lnexports long id
"GBR" "ITA" 1999 0 0   1487.00617169075 58.682464599609375 56.916316986083984 1558317367296 1249057046528 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.274977 1
"GBR" "ITA" 2000 0 0   1487.00617169075 58.892513275146484 56.942108154296875 1548663914496 1142213967872 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.255974 1
"GBR" "ITA" 2001 0 0   1487.00617169075  59.11967468261719 56.974098205566406 1529094602752 1162784800768 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.191116 1
"GBR" "ITA" 2002 0 0   1487.00617169075 59.370479583740234  57.05900573730469 1674417012736 1267043139584 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.259645 1
"GBR" "ITA" 2003 0 0   1487.00617169075  59.64757537841797 57.313201904296875 1943714267136 1570330640384 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.35397 1
"GBR" "ITA" 2004 0 0   1487.00617169075   59.9879035949707 57.685325622558594 2298127056896 1799204110336 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.45284 1
"GBR" "ITA" 2005 0 0   1487.00617169075 60.401206970214844    57.969482421875 2412116443136 1853465952256 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.46312 1
"GBR" "ITA" 2006 0 0   1487.00617169075  60.84682083129883 58.143978118896484 2582815965184 1943430758400 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.55687 1
"GBR" "ITA" 2007 0 0   1487.00617169075  61.32246398925781  58.43830871582031 2963265290240 2203972534272 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.600397 1
"GBR" "ITA" 2008 0 0   1487.00617169075   61.8069953918457  58.82673263549805 2791855095808 2391963598848 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.55619 1
"GBR" "ITA" 2009 0 0   1487.00617169075  62.27627182006836  59.09536361694336 2308925816832 2186107551744 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.265293 1
"GBR" "ITA" 2010 0 0   1487.00617169075  62.76636505126953  59.27741622924805 2407933673472 2126620393472 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.30525 1
"GBR" "ITA" 2011 0 0   1487.00617169075  63.25891876220703  59.37944793701172 2591846039552 2278230327296 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"   23.4681 1
"GBR" "ITA" 2012 0 0   1487.00617169075  63.69568634033203  59.53971862792969 2614946430976 2091760746496 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.23309 1
"GBR" "ITA" 2013 0 0   1487.00617169075  64.09708404541016 59.831092834472656 2678455009280 2149484462080 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.274055 1
"GBR" "ITA" 2014 0 0   1487.00617169075   64.6131591796875  60.78913879394531 2998833512448 2149814239232 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA"  23.38004 1
"GBR" "ITA" 2015 0 0   1487.00617169075  65.13822937011719 60.802085876464844 2858003202048 1821496967168 244110 301323 0 0 .10965 1 1 1 "United Kingdom" "Italy"          "GBRITA" 23.276005 1
"ITA" "GBR" 1999 0 0 1487.0061916424752 56.916316986083984 58.682464599609375 1249057046528 1558317367296 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.554144 1
"ITA" "GBR" 2000 0 0 1487.0061916424752 56.942108154296875 58.892513275146484 1142213967872 1548663914496 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.533863 1
"ITA" "GBR" 2001 0 0 1487.0061916424752 56.974098205566406  59.11967468261719 1162784800768 1529094602752 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.52781 1
"ITA" "GBR" 2002 0 0 1487.0061916424752  57.05900573730469 59.370479583740234 1267043139584 1674417012736 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.600157 1
"ITA" "GBR" 2003 0 0 1487.0061916424752 57.313201904296875  59.64757537841797 1570330640384 1943714267136 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.77652 1
"ITA" "GBR" 2004 0 0 1487.0061916424752 57.685325622558594   59.9879035949707 1799204110336 2298127056896 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.94356 1
"ITA" "GBR" 2005 0 0 1487.0061916424752    57.969482421875 60.401206970214844 1853465952256 2412116443136 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.923113 1
"ITA" "GBR" 2006 0 0 1487.0061916424752 58.143978118896484  60.84682083129883 1943430758400 2582815965184 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.95571 1
"ITA" "GBR" 2007 0 0 1487.0061916424752  58.43830871582031  61.32246398925781 2203972534272 2963265290240 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  24.09473 1
"ITA" "GBR" 2008 0 0 1487.0061916424752  58.82673263549805   61.8069953918457 2391963598848 2791855095808 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  24.07514 1
"ITA" "GBR" 2009 0 0 1487.0061916424752  59.09536361694336  62.27627182006836 2186107551744 2308925816832 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.76135 1
"ITA" "GBR" 2010 0 0 1487.0061916424752  59.27741622924805  62.76636505126953 2126620393472 2407933673472 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.871416 1
"ITA" "GBR" 2011 0 0 1487.0061916424752  59.37944793701172  63.25891876220703 2278230327296 2591846039552 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.91842 1
"ITA" "GBR" 2012 0 0 1487.0061916424752  59.53971862792969  63.69568634033203 2091760746496 2614946430976 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.91594 1
"ITA" "GBR" 2013 0 0 1487.0061916424752 59.831092834472656  64.09708404541016 2149484462080 2678455009280 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 23.982174 1
"ITA" "GBR" 2014 0 0 1487.0061916424752  60.78913879394531   64.6131591796875 2149814239232 2998833512448 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA" 24.047684 1
"ITA" "GBR" 2015 0 0 1487.0061916424752 60.802085876464844  65.13822937011719 1821496967168 2858003202048 301323 244110 0 0 .10965 1 1 1 "Italy"          "United Kingdom" "GBRITA"  23.93344 1
end
label values id id
label def id 1 "GBRITA", modify
Country pairs have been estimated using
Code:
gen newid = cond(iso3_o <= iso3_d, iso3_o, iso3_d) ///
+ cond(iso3_o >= iso3_d, iso3_o, iso3_d)
At this point I want to generate the dependent variable as average of exports between UK and Italy, using the collapse command. This causes the data set to reduce in half.
However, a command has to be specified for the other variables which include country-specific and dyads characteristics.

Using:
Code:
collapse (mean) lnexports lnimports simpleaverage weightedaverage (last) iso3_o ///
 iso3_d contig comlang_off distw pop_o pop_d gdp_o gdp_d gdpcap_o gdpcap_d ///
 area_o area_d colony comcur comrelig gatt_o gatt_d fta_wto eu_o eu_d ///
 country_o country_d, by (newid year)
Specifying last, there are no issues with dyads variables, such as contiguity (contig) or common currency (comcur), but GDP will take only one value for each year, which can be that of the exporter or the importer. This will bias the estimation, since for each country pair there will be some observations in which UK is exporter and Italy importer and for others vice-versa. Same for population (pop) or area. In this way I would lose the country-time effects for exporter and importer.

A procedure I have seen is to take the multiplicative form of country pairs, as to create one variable that changes over time but not over pairs for the same year, e.g. GDP = log(gdp_o * gdp_d)


What do you guys suggest?

Thanks