sils estimates gravity models via
Structural Iterated Least Squares and an explicit inclusion
of the Multilateral Resistance terms.
sils(dependent_variable, distance, additional_regressors = NULL, income_origin, income_destination, code_origin, code_destination, maxloop = 100, decimal_places = 4, robust = FALSE, verbose = FALSE, data, ...)
(Type: character) name of the dependent variable. This dependent variable is
divided by the product of unilateral incomes such (i.e.
(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 GDP should be inserted via the arguments
Write this argument as
(Type: character) origin income variable (e.g. GDP) in the dataset.
(Type: character) destination income variable (e.g. GDP) in the dataset.
(Type: character) country of origin variable (e.g. ISO-3 country codes). The variables are grouped using this parameter.
(Type: character) country of destination variable (e.g. country ISO-3 codes). The variables are grouped using this parameter.
(Type: numeric) maximum number of outer loop iterations. The default is set to 100. There will be a warning if the iterations did not converge.
(Type: numeric) number of decimal places that should not change after a new iteration for the estimation to stop. The default is set to 4.
(Type: logical) whether robust fitting should be used. By default this is set to
(Type: logical) determines whether the estimated coefficients
of each iteration should be printed in the console. The default is set
(Type: data.frame) the dataset to be used.
Additional arguments to be passed to the function.
The function returns the summary of the estimated gravity model as an
lm-object. It furthermore returns the resulting coefficients for each
sils is an estimation method for gravity models
developed by Head and Mayer (2014)
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,
and we do not recommend to apply this method in this case.
For more information on gravity models, theoretical foundations and estimation methods in general see
Anderson JE (1979). “A Theoretical Foundation for the Gravity Equation.” The American Economic Review, 69(1), 106--116. ISSN 00028282.
Anderson JE, van Wincoop E (2001). “Gravity with Gravitas: A Solution to the Border Puzzle.” Technical Report 8079, National Bureau of Economic Research. doi: 10.3386/w8079 .
Anderson JE (2010). “The Gravity Model.” Technical Report 16576, National Bureau of Economic Research. doi: 10.3386/w16576 .
Baier SL, Bergstrand JH (2009). “Bonus vetus OLS: A simple method for approximating international trade-cost effects using the gravity equation.” Journal of International Economics, 77(1), 77 - 85. ISSN 0022-1996, doi: 10.1016/j.jinteco.2008.10.004 .
Baier SL, Bergstrand JH (2010). “The Gravity Model in International Trade: Advances and Applications.” In van Bergeijk PAG, Brakman S (eds.), chapter 4. Cambridge University Press. doi: 10.1017/CBO9780511762109 .
Feenstra RC (2002). “Border effects and the gravity equation: consistent methods for estimation.” Scottish Journal of Political Economy, 49(5), 491--506.
Head K, Mayer T, Ries J (2010). “The erosion of colonial trade linkages after independence.” Journal of International Economics, 81(1), 1 - 14. ISSN 0022-1996, doi: 10.1016/j.jinteco.2010.01.002 .
Head K, Mayer T (2014). “Chapter 3 - Gravity Equations: Workhorse,Toolkit, and Cookbook.” In Gopinath G, Helpman E, Rogoff K (eds.), Handbook of International Economics, volume 4 of Handbook of International Economics, 131 - 195. Elsevier. doi: 10.1016/B978-0-444-54314-1.00003-3 .
Silva JMCS, Tenreyro S (2006). “The Log of Gravity.” The Review of Economics and Statistics, 88(4), 641-658. doi: 10.1162/rest.88.4.641 .
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
Egger P, Pfaffermayr M (2003). “The proper panel econometric specification of the gravity equation: A three-way model with bilateral interaction effects.” Empirical Economics, 28(3), 571--580. ISSN 1435-8921, doi: 10.1007/s001810200146 .
Gómez-Herrera E (2013). “Comparing alternative methods to estimate gravity models of bilateral trade.” Empirical Economics, 44(3), 1087--1111. ISSN 1435-8921, doi: 10.1007/s00181-012-0576-2 .
and the references therein.
# 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 <- sils( dependent_variable = "flow", distance = "distw", additional_regressors = "rta", income_origin = "gdp_o", income_destination = "gdp_d", code_origin = "iso_o", code_destination = "iso_d", maxloop = 50, dec_places = 3, robust = FALSE, verbose = FALSE, data = grav_small )