ek_tobit | R Documentation |

`ek_tobit`

estimates gravity models in their additive form
by conducting a censored regression.

```
ek_tobit(
dependent_variable,
distance,
additional_regressors = NULL,
code_destination,
robust = FALSE,
data,
...
)
```

`dependent_variable` |
(Type: character) name of the dependent variable. 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. |

`distance` |
(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. |

`additional_regressors` |
(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 |

`code_destination` |
(Type: character) country of destination variable (e.g. country ISO-3 codes). The variables are grouped using this parameter. |

`robust` |
(Type: logical) whether robust fitting should be used. By default this is set to |

`data` |
(Type: data.frame) the dataset to be used. |

`...` |
Additional arguments to be passed to the function. |

`ek_tobit`

represents the \insertCiteEaton2001;textualgravity Tobit model where each country
is assigned specific censoring bounds.

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 \insertCiteEaton1995;textualgravity
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.

The function returns the summary of the estimated gravity model as a
`survreg`

-object.

For more information on gravity models, theoretical foundations and estimation methods in general see

\insertRefAnderson1979gravity

\insertRefAnderson2001gravity

\insertRefAnderson2010gravity

\insertRefBaier2009gravity

\insertRefBaier2010gravity

\insertRefFeenstra2002gravity

\insertRefHead2010gravity

\insertRefHead2014gravity

\insertRefSantos2006gravity

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

\insertRefEgger2003gravity

\insertRefGomez-Herrera2013gravity

and the references therein.

`Surv`

, `survreg`

, `tobit`

```
# 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)
grav_small <- grav_small %>%
mutate(
flow = ifelse(flow < 5, 0, flow), # cutoff for testing purposes
lgdp_o = log(gdp_o),
lgdp_d = log(gdp_d)
)
fit <- ek_tobit(
dependent_variable = "flow",
distance = "distw",
additional_regressors = c("distw", "rta", "lgdp_o", "lgdp_d"),
code_destination = "iso_d",
robust = FALSE,
data = grav_small
)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.