Dear everyone,
I am trying to obtain predicted values for a trade gravity equation from a panel of bilateral trade relations. For my application it is important that the sum of overall trade in the predictions corresponds exactly to the overall sum of trade in the original data.
I consulted Arvis, J-F. and Shepherd, B. (2013) The Poisson quasi-maximum likelihood estimator: a solution to the ‘adding up’ problem in gravity models. Applied Economics Letters. (link below) They find that PPML does in fact preserve the overall sum of trade and is furthermore the only estimator to do so.
I am using ppmlhdfe to estimate the gravity equation. My code is:
egen check = total(pr_grav)
egen check2 = total(tradevalue)
gen check3 = check / check2
egen check_y2 = total(tradevalue), by(year importer)
gen check_y3 = check_y1 / check_y2
Thank you for your help
I am trying to obtain predicted values for a trade gravity equation from a panel of bilateral trade relations. For my application it is important that the sum of overall trade in the predictions corresponds exactly to the overall sum of trade in the original data.
I consulted Arvis, J-F. and Shepherd, B. (2013) The Poisson quasi-maximum likelihood estimator: a solution to the ‘adding up’ problem in gravity models. Applied Economics Letters. (link below) They find that PPML does in fact preserve the overall sum of trade and is furthermore the only estimator to do so.
I am using ppmlhdfe to estimate the gravity equation. My code is:
ppmlhdfe tradevalue ln_dist_air $dist_inds, abs(i.importercode#i.year i.exportercode#i.year) d vce(robust)where tradevalue is levels of bilateral trade, ln_dist_air is log of great-circle distanceand $dist_inds area number of distance indicator variables. I include importer-year and exporter-year effects to account for multilateral resistance and country sizes in each period. I have several questions:
- Will the predicted values obtained from running predict, xb be predicted trade in logs or in levels? From the lin-log specification of PPML generally I would expect them to be in levels.
- The sums of my predicted results (both for logs and levels) overall, by year as well as by year and exporter are far from their corresponding sums in the observed data. That is although from eq(10) or eq(11) in Arvis and Shepherd (2013) (i.e. the FOC for the log-likelihood in PPML) it becomes clear that including year-importer fixed effects should render these sums equal for each exporter in each year. The total sum of all predicted to all observed trade should also be equal.
Following my estimation I run:
egen check = total(pr_grav)
egen check2 = total(tradevalue)
gen check3 = check / check2
For the ratio of the sums Check2 I obtain a value of 0.039, where I would expect it to be precisely 1. That implies that overall trade is smaller than observed trade by a factor of 25.egen check_y1 = total(pr_grav), by(year importer)
Similarly, for the sum of importer-year trade I run
egen check_y2 = total(tradevalue), by(year importer)
gen check_y3 = check_y1 / check_y2
Again, I obtain arbitrary values, most of which range from 0.02 to 56 (implying that the sum of predicted values are off by up to a factor 56).My core question now is: Does absorbing the fixed effects in ppmlhdfe render the result by Arvis and Shepherd invalid in some way or am I making a grave mistake?
Thank you for your help
Comment