Learn R Programming

gravity (version 0.8.5)

ddm: Double Demeaning (DDM)

Description

ddm estimates gravity models via double demeaning the left hand side and right hand side of the gravity equation.

Usage

ddm(dependent_variable, regressors, codes, robust = TRUE, data, ...)

Arguments

dependent_variable

name (type: character) of the dependent variable in the dataset data (e.g. trade flows).

This variable is logged and then used as the dependent variable in the estimation.

regressors

name (type: character) of the regressors to include in the model.

Include the distance variable in the dataset data containing a measure of distance between all pairs of bilateral partners and bilateral variables that should be taken as the independent variables in the estimation.

Write this argument as c(distance, contiguity, common curreny, ...).

codes

variable name (type: character) of the code of the country of origin and destination (e.g. ISO-3 codes from the variables iso_o and iso_d) in the example datasets).

The variables are grouped by using iso_o and iso_d to obtain estimates.

Write this argument as c(code origin, code destination).

robust

robust (type: logical) determines whether a robust variance-covariance matrix should be used. By default is set to TRUE.

If robust = TRUE the estimation results are consistent with the Stata code provided at Gravity Equations: Workhorse, Toolkit, and Cookbook when choosing robust estimation.

data

name of the dataset to be used (type: character).

To estimate gravity equations you need a square dataset including bilateral flows defined by the argument dependent_variable, ISO codes or similar of type character (e.g. iso_o for the country of origin and iso_d for the destination country), a distance measure defined by the argument distance and other potential influences (e.g. contiguity and common currency) given as a vector in regressors are required.

All dummy variables should be of type numeric (0/1).

Make sure the ISO codes are of type "character".

If an independent variable is defined as a ratio, it should be logged.

The user should perform some data cleaning beforehand to remove observations that contain entries that can distort estimates.

The function will remove zero flows and distances.

...

additional arguments to be passed to ddm.

Value

The function returns the summary of the estimated gravity model as an lm-object.

Details

ddm is an estimation method for gravity models presented in Head2014;textualgravity.

Country specific effects are subdued due double demeaning. Hence, unilateral income proxies such as GDP cannot be considered as exogenous variables.

Unilateral effect drop out due to double demeaning and therefore cannot be estimated.

ddm is designed to be consistent with the Stata code provided at Gravity Equations: Workhorse, Toolkit, and Cookbook when choosing robust estimation.

As, to our knowledge at the moment, there is no explicit literature covering the estimation of a gravity equation by ddm using panel data, we do not recommend to apply this method in this case.

References

For more information on Double Demeaning as well as information on gravity models, theoretical foundations and estimation methods in general see

Head2014gravity

as well as

Anderson1979gravity

Anderson2001gravity

Anderson2010gravity

Baier2009gravity

Baier2010gravity

Head2010gravity

Santos2006gravity

and the citations therein.

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

See Also

lm, coeftest, vcovHC

Examples

Run this code
# NOT RUN {
data(gravity_no_zeros)

ddm(dependent_variable = "flow", regressors = c("distw", "rta"),
codes = c("iso_o", "iso_d"),
robust = TRUE, data = gravity_no_zeros)

ddm(dependent_variable = "flow", regressors = c("distw", "rta", "comcur", "contig"),
codes = c("iso_o", "iso_d"),
robust=TRUE, data=gravity_no_zeros)
# }
# NOT RUN {
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab