sils
estimates gravity models via
Structural Iterated Least Squares and an explicit inclusion
of the Multilateral Resistance terms.
sils(dependent_variable, regressors, incomes, maxloop = 50,
decimal_places = 4, robust = TRUE, verbose = FALSE, data, ...)
name (type: character) of the dependent variable in the dataset
data
(e.g. trade flows).
This dependent variable is divided by the
product of unilateral incomes (e.g.
GDPs or GNPs of the countries of interest, named inc_o
and inc_d
in the example datasets)
and logged afterwards.
The transformed variable is 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 metric variables such as GDPs should be inserted via the argument incomes
.
As country specific effects are subdued due to demeaning, no further unilateral variables apart from unilateral incomes can be added.
Write this argument as c(distance, contiguity, common curreny, ...)
.
variable name (type: character) of the income of the country of
origin (e.g. inc_o
) and destination (e.g. inc_d
) in the dataset data
.
The dependent variable dependent_variable
is divided by the product of the incomes.
Write this argument as c(income origin, income destination)
.
maximum number of outer loop iterations. The default is set to 100. There will be a warning if the iterations did not converge.
number of decimal places that should not change after a new iteration for the estimation to stop. The default is set to 4.
robust (type: logic) determines whether a robust
variance-covariance matrix should be used. The default is set to TRUE
.
If set TRUE
the estimation results are consistent with the
Stata code provided at the website
Gravity Equations: Workhorse, Toolkit, and Cookbook
when choosing robust estimation.
(type: logic) determines whether the estimated coefficients
of each iteration should be printed in the console. The default is set
to FALSE
.
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 functions used by
sils
.
The function returns the summary of the estimated gravity model as an
lm
-object. It furthermore returns the resulting coefficients for each
iteration.
sils
is an estimation method for gravity models
developed by Head2014;textualgravity.
The function sils
utilizes the relationship between the Multilateral
Resistance terms and the transaction costs. The parameters are estimated by
an iterative procedure. The function executes loops until the parameters
stop changing significantly.
sils
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 sils
using panel data,
we do not recommend to apply this method in this case.
For information on sils
as well as more information on gravity
models, theoretical foundations and suitable estimation methods in general see
Head2014gravity
Anderson2001gravity
For more information on gravity models, theoretical foundations and estimation methods in general see
Anderson1979gravity
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.
# NOT RUN {
data(gravity_no_zeros)
sils(dependent_variable = "flow", regressors = c("distw", "rta"),
incomes = c("gdp_o", "gdp_d"),
maxloop = 100, dec_places = 4, robust = TRUE, verbose = FALSE,
data = gravity_no_zeros)
sils(dependent_variable = "flow", regressors = c("distw", "rta", "comcur", "contig"),
incomes = c("gdp_o", "gdp_d"),
maxloop = 100, dec_places = 4, robust = TRUE, verbose = FALSE,
data = gravity_no_zeros)
# }
# NOT RUN {
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab