Gravity
Gravity: Estimation Methods for Gravity Models in R - Published in JOSS (2018)
Science Score: 59.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 9 committers (11.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Keywords
bvu
bvw
ddm
econometrics
glm
gpml
gravity
international-trade
lm
maximum-likelihood
nbpml
nls
ols
ppml
r
sils
tobit
trade
Last synced: 6 months ago
·
JSON representation
Repository
R package that provides estimation methods for Gravity Models
Basic Info
- Host: GitHub
- Owner: pachadotdev
- License: apache-2.0
- Language: R
- Default Branch: master
- Homepage: https://pacha.dev/gravity/
- Size: 26.5 MB
Statistics
- Stars: 37
- Watchers: 1
- Forks: 12
- Open Issues: 4
- Releases: 0
Fork of jpburgard/gravity
Topics
bvu
bvw
ddm
econometrics
glm
gpml
gravity
international-trade
lm
maximum-likelihood
nbpml
nls
ols
ppml
r
sils
tobit
trade
Created almost 8 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
Funding
License
Codemeta
README.Rmd
---
output: github_document
bibliography: inst/REFERENCES.bib
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# gravity
[](https://www.repostatus.org/#active)
[](https://www.tidyverse.org/lifecycle/#stable)
[](https://github.com/pachadotdev/gravity/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=gravity)
[](https://codecov.io/github/pachadotdev/gravity?branch=master)
[](https://doi.org/10.21105/joss.01038)
[](https://doi.org/10.17713/ajs.v47i4.688)
## About
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 provides estimation methods for log-log models and multiplicative models.
Log-log estimation covers:
- 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
- Different Tobit models (Tobit, ET-Tobit, EK-Tobit)
Log-log models 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.
Multiplicative estimation covers:
- Poisson Pseudo Maximum Likelihood (PPML)
- Gamma Pseudo Maximum Likelihood (GPML)
- Negative Binomial Pseudo Maximum Likelihood (NBPML)
- Nonlinear Least Squares (NLS)
Multiplicative models are covered with a log-link and different families of distributions. These models are relatively easy to compute.
All functions named estimate gravity models, but they differ in whether they estimate them in their additive or multiplicative 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.
@Head2014 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 datasets, 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 state-of-the-art exposition about cross-sectional data see @WoelwerBressleinBurgard2018, and for a comprehensive overview of gravity models for panel data see @Egger2003, @Gomez-Herrera2013 and @Head2010 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.
## How to install
From R console:
```{r, eval = FALSE}
# Install from CRAN
install.packages("gravity")
# Install from GitHub
devtools::install_github("pachadotdev/gravity")
```
## Community guidelines
If you want to contribute to the software, report issues or problems with the software, please fork the repo and send us a Pull Request or open an issue. We are happy to receive ideas and we would do our best to coordinate efforts and improve this package without reinventing the wheel.
If you seek support or have questions you can start a thread on the issues section, or you can email us but we prefer open issues as probably more users have the same questions as you.
## References
Owner
- Name: Mauricio "Pachá" Vargas Sepúlveda
- Login: pachadotdev
- Kind: user
- Website: https://pacha.dev
- Repositories: 308
- Profile: https://github.com/pachadotdev
Statistician interested in applying statistical methods to address specific policy-relevant questions, particularly in international trade.
CodeMeta (codemeta.json)
{
"@context": [
"https://doi.org/10.5063/schema/codemeta-2.0",
"http://schema.org"
],
"@type": "SoftwareSourceCode",
"identifier": "gravity",
"description": "A wrapper of different standard estimation methods for gravity models. \n This package provides estimation methods for log-log models and multiplicative models.",
"name": "gravity: Estimation Methods for Gravity Models",
"codeRepository": "http://pachamaltese.github.io/gravity",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.9.8",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"version": "3.5.3",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 3.5.3 (2019-03-11)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"author": [
{
"@type": "Person",
"givenName": "Anna-Lena",
"familyName": "Woelwer",
"email": "woelwer@uni-trier.de"
},
{
"@type": "Person",
"givenName": "Jan Pablo",
"familyName": "Burgard",
"email": "burgardj@uni-trier.de"
},
{
"@type": "Person",
"givenName": "Joshua",
"familyName": "Kunst",
"email": "jbkunst@gmail.com"
},
{
"@type": "Person",
"givenName": "Mauricio",
"familyName": "Vargas",
"email": "mvargas@dcc.uchile.cl",
"@id": "https://orcid.org/0000-0003-1017-7574"
}
],
"contributor": [
{
"@type": "Person",
"givenName": "Romain",
"familyName": "Francois",
"email": "romain@purrple.cat"
},
{
"@type": "Person",
"givenName": "Lionel",
"familyName": "Henry",
"email": "lionel@rstudio.com"
}
],
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Anna-Lena",
"familyName": "Woelwer",
"email": "woelwer@uni-trier.de"
},
{
"@type": "Person",
"givenName": "Jan Pablo",
"familyName": "Burgard",
"email": "burgardj@uni-trier.de"
},
{
"@type": "Person",
"givenName": "Joshua",
"familyName": "Kunst",
"email": "jbkunst@gmail.com"
},
{
"@type": "Person",
"givenName": "Mauricio",
"familyName": "Vargas",
"email": "mvargas@dcc.uchile.cl",
"@id": "https://orcid.org/0000-0003-1017-7574"
}
],
"funder": {},
"maintainer": [
{
"@type": "Person",
"givenName": "Mauricio",
"familyName": "Vargas",
"email": "mvargas@dcc.uchile.cl",
"@id": "https://orcid.org/0000-0003-1017-7574"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
},
{
"@type": "SoftwareApplication",
"identifier": "broom",
"name": "broom",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=broom"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "lmtest",
"name": "lmtest",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lmtest"
},
{
"@type": "SoftwareApplication",
"identifier": "sandwich",
"name": "sandwich",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sandwich"
},
{
"@type": "SoftwareApplication",
"identifier": "glm2",
"name": "glm2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=glm2"
},
{
"@type": "SoftwareApplication",
"identifier": "MASS",
"name": "MASS",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=MASS"
},
{
"@type": "SoftwareApplication",
"identifier": "stats",
"name": "stats"
},
{
"@type": "SoftwareApplication",
"identifier": "censReg",
"name": "censReg",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=censReg"
},
{
"@type": "SoftwareApplication",
"identifier": "survival",
"name": "survival",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=survival"
},
{
"@type": "SoftwareApplication",
"identifier": "multiwayvcov",
"name": "multiwayvcov",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=multiwayvcov"
},
{
"@type": "SoftwareApplication",
"identifier": "tibble",
"name": "tibble",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tibble"
},
{
"@type": "SoftwareApplication",
"identifier": "magrittr",
"name": "magrittr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=magrittr"
},
{
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=dplyr"
},
{
"@type": "SoftwareApplication",
"identifier": "tidyr",
"name": "tidyr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tidyr"
},
{
"@type": "SoftwareApplication",
"identifier": "purrr",
"name": "purrr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=purrr"
},
{
"@type": "SoftwareApplication",
"identifier": "rlang",
"name": "rlang",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rlang"
},
{
"@type": "SoftwareApplication",
"identifier": "Rdpack",
"name": "Rdpack",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=Rdpack"
},
{
"@type": "SoftwareApplication",
"identifier": "utils",
"name": "utils"
},
{
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 3.4.0"
}
],
"readme": "https://github.com/pachamaltese/gravity/blob/master/README.md",
"fileSize": "675.282KB",
"contIntegration": [
"https://travis-ci.org/pachamaltese/gravity",
"https://codecov.io/github/pachamaltese/gravity?branch=master"
],
"issueTracker": "https://github.com/pachamaltese/gravity/issues",
"developmentStatus": [
"https://www.repostatus.org/#active",
"https://www.tidyverse.org/lifecycle/#stable"
],
"relatedLink": "https://CRAN.R-project.org/package=gravity"
}
GitHub Events
Total
- Issues event: 1
- Watch event: 2
- Issue comment event: 1
- Push event: 1
Last Year
- Issues event: 1
- Watch event: 2
- Issue comment event: 1
- Push event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Mauricio Vargas | m****s@d****l | 121 |
| Mauricio Vargas | m****1@u****l | 10 |
| pachamaltese | m****s@u****l | 10 |
| Joshua Kunst | j****t@g****m | 8 |
| Sarah Johnson | s****3@g****m | 3 |
| Jan Pablo Burgard | b****j@u****e | 2 |
| jpburgard | p****o@b****e | 1 |
| Yo Yehudi | y****h@g****m | 1 |
| Romain Francois | r****n@p****t | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 18
- Total pull requests: 5
- Average time to close issues: 2 months
- Average time to close pull requests: about 6 hours
- Total issue authors: 9
- Total pull request authors: 4
- Average comments per issue: 1.78
- Average comments per pull request: 1.4
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- pachadotdev (7)
- DiegoKoz (3)
- scharlottej13 (2)
- marcoaurelioguerrap (1)
- etiennebacher (1)
- zeileis (1)
- anbelmar (1)
- mpadge (1)
Pull Request Authors
- scharlottej13 (2)
- pachadotdev (1)
- romainfrancois (1)
- yochannah (1)
Top Labels
Issue Labels
enhancement (2)
good first issue (1)
hacktoberfest (1)
bug (1)
Pull Request Labels
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 3.4.0 depends
- MASS * imports
- Rdpack * imports
- censReg * imports
- dplyr * imports
- glm2 * imports
- lmtest * imports
- magrittr * imports
- multiwayvcov * imports
- purrr * imports
- rlang * imports
- sandwich * imports
- stats * imports
- survival * imports
- tibble * imports
- tidyr * imports
- utils * imports
- broom * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests