ppml
estimates gravity models in their
multiplicative form via Poisson Pseudo Maximum Likelihood.
ppml(
dependent_variable,
distance,
additional_regressors,
robust = FALSE,
data,
...
)
The function returns the summary of the estimated gravity model as an
glm
-object.
(Type: character) name of the dependent variable. This variable is 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.
ppml
is an estimation method for gravity models
belonging to generalized linear models. It is estimated via glm
using the quasipoisson
distribution and a log-link. ppml
is presented in Santos2006;textualgravity.
For similar functions, utilizing the multiplicative form via the log-link,
but different distributions, see gpml
, nls
,
and nbpml
.
ppml
estimation can be used for both, cross-sectional as well as
panel data. The function is designed to be consistent with the
results from the Stata function ppml
written by Santos2006;textualgravity.
The function ols
was therefore tested for cross-sectional data. For the use with panel data
no tests were performed. 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. 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 may has 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 Egger2003;textualgravity, Gomez-Herrera2013;textualgravity and Head2010;textualgravity as well as the references therein.
For more information on gravity models, theoretical foundations and estimation methods in general see
Anderson1979gravity
Anderson2001gravity
Anderson2010gravity
Baier2009gravity
Baier2010gravity
Feenstra2002gravity
Head2010gravity
Head2014gravity
Santos2006gravity
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
Egger2003gravity
Gomez-Herrera2013gravity
and the references therein.
glm
, coeftest
,
vcovHC
# 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)
fit <- ppml(
dependent_variable = "flow",
distance = "distw",
additional_regressors = c("rta", "iso_o", "iso_d"),
data = grav_small
)
Run the code above in your browser using DataLab