gpml estimates gravity models in their multiplicative form via Gamma Pseudo Maximum Likelihood.

gpml(dependent_variable, distance, additional_regressors, robust = FALSE,
data, ...)

## Arguments

dependent_variable (Type: character) name of the dependent variable. This variable is logged and then used as the dependent variable in the estimation. (Type: character) name of the distance variable that should be taken as the key independent variable in the estimation. The distance is logged automatically when the function is executed. (Type: character) names of the additional regressors to include in the model (e.g. a dummy variable to indicate contiguity). Unilateral metric variables such as GDPs can be added but those variables have to be logged first. Interaction terms can be added. Write this argument as c(contiguity, common currency, ...). By default this is set to NULL. (Type: logical) whether robust fitting should be used. By default this is set to FALSE. (Type: data.frame) the dataset to be used. Additional arguments to be passed to the function.

## Value

The function returns the summary of the estimated gravity model similar to a glm-object.

## Details

gpml is an estimation method for gravity models belonging to generalized linear models. It is described in Silva and Tenreyro (2006) and the model is estimated via glm2 using the gamma distribution and a log-link.

For similar functions, utilizing the multiplicative form via the log-link, but different distributions, see ppml, nls, and nbpml.

gpml estimation can be used for both, cross-sectional as well as panel data, but its up to the user to ensure that the functions can be applied to panel data.

Depending on the panel dataset and the variables - specifically the type of fixed effects - included in the model, it may easily occur that the model is not computable.

Also, note that by including bilateral fixed effects such as country-pair effects, the coefficients of time-invariant observables such as distance can no longer be estimated.

Depending on the specific model, the code of the respective function might have to be changed in order to exclude the distance variable from the estimation.

At the very least, the user should take special care with respect to the meaning of the estimated coefficients and variances as well as the decision about which effects to include in the estimation.

When using panel data, the parameter and variance estimation of the models may have to be changed accordingly.

For a comprehensive overview of gravity models for panel data see Egger and Pfaffermayr (2003) , Gómez-Herrera (2013) and Head et al. (2010) .

## References

For more information on gravity models, theoretical foundations and estimation methods in general see

Anderson JE (1979). “A Theoretical Foundation for the Gravity Equation.” The American Economic Review, 69(1), 106--116. ISSN 00028282.

Anderson JE, van Wincoop E (2001). “Gravity with Gravitas: A Solution to the Border Puzzle.” Technical Report 8079, National Bureau of Economic Research. doi: 10.3386/w8079 .

Anderson JE (2010). “The Gravity Model.” Technical Report 16576, National Bureau of Economic Research. doi: 10.3386/w16576 .

Baier SL, Bergstrand JH (2009). “Bonus vetus OLS: A simple method for approximating international trade-cost effects using the gravity equation.” Journal of International Economics, 77(1), 77 - 85. ISSN 0022-1996, doi: 10.1016/j.jinteco.2008.10.004 .

Baier SL, Bergstrand JH (2010). “The Gravity Model in International Trade: Advances and Applications.” In van Bergeijk PAG, Brakman S (eds.), chapter 4. Cambridge University Press. doi: 10.1017/CBO9780511762109 .

Feenstra RC (2002). “Border effects and the gravity equation: consistent methods for estimation.” Scottish Journal of Political Economy, 49(5), 491--506.

Head K, Mayer T, Ries J (2010). “The erosion of colonial trade linkages after independence.” Journal of International Economics, 81(1), 1 - 14. ISSN 0022-1996, doi: 10.1016/j.jinteco.2010.01.002 .

Head K, Mayer T (2014). “Chapter 3 - Gravity Equations: Workhorse,Toolkit, and Cookbook.” In Gopinath G, Helpman E, Rogoff K (eds.), Handbook of International Economics, volume 4 of Handbook of International Economics, 131 - 195. Elsevier. doi: 10.1016/B978-0-444-54314-1.00003-3 .

Silva JMCS, Tenreyro S (2006). “The Log of Gravity.” The Review of Economics and Statistics, 88(4), 641-658. doi: 10.1162/rest.88.4.641 .

and the citations therein.

See Gravity Equations: Workhorse, Toolkit, and Cookbook for gravity datasets and Stata code for estimating gravity models.

For estimating gravity equations using panel data see

Egger P, Pfaffermayr M (2003). “The proper panel econometric specification of the gravity equation: A three-way model with bilateral interaction effects.” Empirical Economics, 28(3), 571--580. ISSN 1435-8921, doi: 10.1007/s001810200146 .

Gómez-Herrera E (2013). “Comparing alternative methods to estimate gravity models of bilateral trade.” Empirical Economics, 44(3), 1087--1111. ISSN 1435-8921, doi: 10.1007/s00181-012-0576-2 .

and the references therein.

## See also

glm2, coeftest, vcovHC

## Examples

# Example for CRAN checks:
# Executable in < 5 sec
library(dplyr)
data("gravity_no_zeros")

# Choose 5 countries for testing
countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)

grav_small <- grav_small %>%
mutate(
lgdp_o = log(gdp_o),
lgdp_d = log(gdp_d)
)

fit <- gpml(
dependent_variable = "flow",
distance = "distw",
additional_regressors = c("rta", "iso_o", "iso_d"),
data = grav_small
)