Gravity models are used to explain bilateral flows related to the sizes of bilateral partners, a measure of distance between them and other influences on interaction costs. The underlying idea is rather simple. The greater the masses of two bodies and the smaller the distance between them, the stronger their attraction. This concept is applied to several research topics such as trade, migration or foreign direct investment. Even though their basic idea is rather simple, gravity models can become complex regarding the choice of models or estimation methods. As especially for gravity beginners it is difficult to get an overview of the different methods and implement them in R, the package provides a wrapper of different standard estimation methods for gravity models. By considering the descriptions and codes of the estimation methods, users get a comprehensive and application-oriented overview of the different methods, see which method may be suitable for a certain research question or type of data and extend the code available to their research projects. The package contains two types of estimation methods: those estimating gravity models in their log-log form, such as Ordinary Least Squares (OLS), Fixed Effects, Double Demeaning (DDM), Bonus vetus OLS with simple averages (BVU) and with GDP-weights (BVW), Structural Iterated Least Squares (SILS), Tetrads, and different Tobit models (Tobit, ET-Tobit, EK-Tobit). These methods are partly complex to understand and program and thus a comparison of them is not straightforward, wherefore the package aims at easing an overview of the different methods combined with a direct application. A second type of estimation methods utilizes the gravity model in its multiplicative form with a log-link and different families of distributions. They are relatively easy to compute, added for completeness and contain the methods Poisson Pseudo Maximum Likelihood (PPML), Gamma Pseudo Maximum Likelihood (GPML), Negative Binomial Pseudo Maximum Likelihood (NBPML), and Nonlinear Least Squares (NLS). All functions named estimate gravity models, but they differ in whether they estimate them in their multiplicative or additive form, their requirements and assumptions with respect to data, their handling of Multilateral Resistance terms as well as their possibilities concerning the inclusion of unilateral independent variables. Therefore, they normally lead to different estimation results. We refer the user to the Gravity Cookbook website (<https://sites.google.com/site/hiegravity/>) for more information on gravity models in general. Head, K. and Mayer, T. (2014) <doi:10.1016/B978-0-444-54314-1.00003-3> provide a comprehensive and accessible overview of the theoretical and empirical development of the gravity literature as well as the use of gravity models and the various estimation methods, especially their merits and potential problems regarding applicability as well as different datasets. In order to have a straightforward application of all methods, the package comes with two example dataset, one including and the other one excluding zero trade flows. Examples utilizing these dataset are included in the description of the methods. As the range of gravity models and their suitable estimation methods is huge and specific to data and research question at hand, the functions are kept simple such that researchers can utilize them as a starting point of their research and get familiar with them. On the Gravity Cookbook website (<https://sites.google.com/site/hiegravity/>) Keith Head and Thierry Mayer provide Stata code for most methods. Where possible, the functions are tested to lead the same results as the Stata code when choosing the option of robust variance estimation. However, compared to the Stata code available, the functions presented in this package provide users with more flexibility regarding the type of estimation, the number and type of independent variables as well as the possible data. Furthermore, additional functions are added. The functions of the package include distance as an independent variable. If a panel model is used time-invariant effects, such as geographical distance, may have to be excluded; see the respective descriptions. Therefore, it is 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. Depending on the specific model, the code of the respective function may has to be changed in order to exclude the distance variable from the estimation. For a comprehensive overview of gravity models for panel data see Egger, P., & Pfaffermayr, M. (2003) <doi:10.1007/s001810200146>, Gomez-Herrera, E. (2013) <doi:10.1007/s00181-012-0576-2> and Head, K., Mayer, T., & Ries, J. (2010) <doi:10.1016/j.jinteco.2010.01.002> as well as the references therein (see also the references included in the descriptions of the different functions). 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. As, to our knowledge at the moment, there is no explicit literature covering the estimation of a gravity equation by Double Demeaning, Structural Iterated Least Squares or Bonus vetus OLS using panel data, we do not recommend to apply these methods in this case. Contributions, extensions and error corrections are very welcome. Please do not hesitate to contact us. We thank Martin Bresslein for valuable comments and advice on early versions of the package.

Version: | 0.6 |

Depends: | R (≥ 3.1.1) |

Imports: | sandwich, multiwayvcov, lmtest, glm2, MASS, stats, censReg, survival |

Published: | 2017-12-14 |

Author: | Anna-Lena Woelwer, Jan Pablo Burgard |

Maintainer: | Anna-Lena Woelwer <woelwer at uni-trier.de> |

License: | GPL-2 |

NeedsCompilation: | no |

CRAN checks: | gravity results |

Reference manual: | gravity.pdf |

Package source: | gravity_0.6.tar.gz |

Windows binaries: | r-devel: gravity_0.6.zip, r-release: gravity_0.6.zip, r-oldrel: gravity_0.6.zip |

OS X binaries: | r-release: gravity_0.6.tgz, r-oldrel: gravity_0.6.tgz |

Old sources: | gravity archive |

Please use the canonical form
`https://CRAN.R-project.org/package=gravity`
to link to this page.