ek_tobit
estimates gravity models in their additive form
by conducting a censored regression.
It follows the Eaton2001;textualgravity Tobit model where each country is assigned specific censoring bounds.
ek_tobit(dependent_variable, regressors, code_destination, robust = 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.
As the log of zero is not defined, all flows equal to zero are replaced by a left open interval with the logged minimum trade flow of the respective importing country as right border.
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.
Unilateral metric variables such as GDPs should be inserted via the argument incomes
.
Interaction terms can be added.
Write this argument as c(distance, contiguity, common curreny, ...)
.
variable name (type: character) of the label of the country
of destination (e.g. ISO-3 code from the iso_d
variable in the example datasets). The variables
are grouped by using iso_d
to obtain estimates.
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.
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 allows zero flows but will remove zero distances.
additional arguments to be passed to ek_tobit
.
The function returns the summary of the estimated gravity model as a
survreg
-object.
ek_tobit
represents the Eaton2001;textualgravity Tobit model.
When taking the log of the gravity equation flows equal to zero
constitute a problem as their log is not defined. Therefore, in ek_tobit
all values of
the dependent variable are redefined as intervals.
The positive observations have both interval bounds equal to their original value.
For zero flows the interval is left open. The right border of the interval is set to the log of the minimum positive trade flow of the respective importing country.
The defined data object of class Surv
is then inserted
in survreg
for the parameter estimation.
ek_tobit
is designed to be consistent with the Stata code provided at
Gravity Equations: Workhorse, Toolkit, and Cookbook
when choosing robust estimation.
For other Tobit functions, see tobit
for a simple Tobit model where number 1
is added to all observations
and et_tobit
for the Eaton and Tamura (1994)
threshold Tobit model where instead of simply adding number 1
to the data the threshold is estimated.
The function is designed for cross-sectional data, but can be extended to panel data using the
survreg
function.
For more information on gravity models, theoretical foundations and estimation methods in general see
Anderson1979gravity
Anderson2001gravity
Anderson2010gravity
Baier2009gravity
Baier2010gravity
Head2010gravity
Santos2006gravity
and the citations therein.
Especially for Tobit models see
Tobin1958gravity
Eaton1995gravity
Eaton2001gravity
Carson2007gravity
See Gravity Equations: Workhorse, Toolkit, and Cookbook for gravity datasets and Stata code for estimating gravity models.
# NOT RUN {
# Example for data with zero trade flows
data(gravity_zeros)
gravity_zeros <- gravity_zeros %>%
mutate(
lgdp_o = log(gdp_o),
lgdp_d = log(gdp_d)
)
ek_tobit(dependent_variable = "flow", regressors = c("distw", "rta","lgdp_o","lgdp_d"),
code_destination = "iso_d",
robust = TRUE, data = gravity_zeros)
# }
# NOT RUN {
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab