tetrads
estimates gravity models
by taking the ratio of the ratio of flows.
tetrads(dependent_variable, regressors, codes, reference_countries = c("JPN",
"USA"), multiway = TRUE, data, ...)
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.
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.
The distance is logged automatically when the function is executed.
Unilateral effects drop as the ratio of ratios is taken.
Write this argument as c(distance, contiguity, common curreny, ...)
.
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)
.
reference exporting and importing country, default is set to
c("JPN", "USA")
Write this argument as c(importing country, exporting country)
.
(type: logic) In case multiway = TRUE
, the
cluster.vcov
function is used for estimation following
Cameron2011;textualgravity multi-way clustering of
variance-covariance matrices.
The default value is set to TRUE
.
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.
When using panel data, a variable for the time may be included in the dataset. Note that the variable for the time dimension should be of type factor.
The time variable can be used as a single dependent variable or interaction
term with other variables such as country identifiers by inserting it into
regressors
or as an optional parameter.
The function will remove zero flows and distances.
additional arguments to be passed to functions used by
tetrads
.
The function returns the summary of the estimated gravity model as an
lm
-object.
tetrads
is an estimation method for gravity models
developed by Head2010;textualgravity.
The function tetrads
utilizes the multiplicative form of the
gravity equation. After choosing a reference exporter A
and
importer B
one can eliminate importer and exporter fixed effects
by taking the ratio of ratios.
Only those exporters trading with the reference importer and importers trading with the reference exporter will remain for the estimation. Therefore, reference countries should preferably be countries which trade with every other country in the dataset.
After restricting the data in this way, tetrads
estimates the gravity
equation in its additive form by OLS.
By taking the ratio of ratios, all monadic effects diminish, hence no unilateral variables such as GDP can be included as independent variables.
tetrads
estimation can be used for both, cross-sectional as well as
panel data. Nonetheless, the function is designed to be consistent with the
Stata code for cross-sectional data provided on the website
Gravity Equations: Workhorse, Toolkit, and Cookbook
when choosing robust estimation.
The function tetrads
was therefore tested for cross-sectional data.
If tetrads is used for panel data, the user may have to drop distance as an independent variable as time-invariant effects drop.
For applying tetrads
to panel data see Head2010;textualgravity.
For information on tetrads
see
Cameron2011gravity
Head2010gravity
For more information on gravity models, theoretical foundations and estimation methods in general see
Anderson1979gravity
Anderson2001gravity
Anderson2010gravity
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.
# NOT RUN {
data(gravity_no_zeros)
tetrads(dependent_variable = "flow", regressors = c("distw", "rta"),
codes = c("iso_o", "iso_d"), reference_countries = c("JPN", "USA"),
multiway = TRUE, data = gravity_no_zeros)
tetrads(dependent_variable = "flow", regressors = c("distw", "rta", "comcur", "contig"),
codes = c("iso_o", "iso_d"), reference_countries = c("JPN", "USA"),
multiway = FALSE, data = gravity_no_zeros)
# }
# NOT RUN {
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab