| Title: | Replication of 'An Advanced Guide To Trade Policy Analysis' | 
| Version: | 0.7.0 | 
| Description: | Datasets from Yotov, et al. (2016, ISBN:978-92-870-4367-2) "An Advanced Guide to Trade Policy Analysis" and functions to report regression summaries with clustered robust standard errors. | 
| URL: | https://github.com/pachadotdev/tradepolicy/ | 
| BugReports: | https://github.com/pachadotdev/tradepolicy/issues/ | 
| License: | CC BY 4.0 | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.1 | 
| Imports: | magrittr, ggplot2, dplyr, tidyr, purrr, fixest (≥ 0.10.4), sandwich, broom, msm, knitr, Formula | 
| Suggests: | testthat, covr | 
| Depends: | R (≥ 4.0) | 
| LazyData: | true | 
| NeedsCompilation: | no | 
| Packaged: | 2024-03-22 17:18:37 UTC; pacha | 
| Author: | Mauricio Vargas Sepulveda
     | 
| Maintainer: | Mauricio Vargas Sepulveda <m.sepulveda@mail.utoronto.ca> | 
| Repository: | CRAN | 
| Date/Publication: | 2024-03-23 11:30:02 UTC | 
tradepolicy: Replication of 'An Advanced Guide To Trade Policy Analysis'
Description
Datasets from Yotov, et al. (2016, ISBN:978-92-870-4367-2) "An Advanced Guide to Trade Policy Analysis" and functions to report regression summaries with clustered robust standard errors.
Author(s)
Maintainer: Mauricio Vargas Sepulveda m.sepulveda@mail.utoronto.ca (ORCID)
Other contributors:
Alexey Kravchenko [thesis advisor]
Constanza Prado [thesis advisor]
Yoto Yotov [thesis advisor]
The United Nations [data contributor, copyright holder, funder]
See Also
Useful links:
Report bugs at https://github.com/pachadotdev/tradepolicy/issues/
Pipe operator
Description
See magrittr::%>% for details.
Usage
lhs %>% rhs
Arguments
lhs | 
 A value or the magrittr placeholder.  | 
rhs | 
 A function call using the magrittr semantics.  | 
Value
The result of calling rhs(lhs).
International Trade Data for Application Exercises in AGTPA
Description
Contains bilateral trade flows for different pairs of countries between 1986 and 2006 and additional variables modelling.
Format
A data frame with 99,981 rows and 17 columns:
- exporter
 Exporter ISO country code
- importer
 Importer ISO country code
- pair_id
 Symmetric Pair ID
- year
 Year
- trade
 Nominal trade flows in current US dollars
- dist
 Population-weighted bilateral distance between country 'i' and 'j', in kilometers
- cntg
 Indicator. Equal to 1 if country 'i' and 'j' share a common border
- lang
 Indicator. Equal to 1 if country 'i' and 'j' speak the same official language
- clny
 Indicator. Equal to 1 if country 'i' and 'j' share a colonial relationship
- rta
 Indicator that is equal to one when country 'i' and 'j' are members of same Regional Trade Agreement
- rta_lag3
 3rd lag of RTA
- rta_lag4
 4th lag of RTA
- rta_lag6
 6th lag of RTA
- rta_lag8
 8th lag of RTA
- rta_lag9
 9th lag of RTA
- rta_lag12
 12th lag of RTA
- rta_lead4
 4th lead of RTA
Details
The data was drawn from the WDI for the year 2005 (earliest year available), the countries with no entry cost data are mainly small probably not in service trade data, and there are some considerations for the countries in this dataset:
KOR designates RKO since 1949
RUS designates SUN between 1949 and 1991
CZE designates CZS between 1949 and 1992
DEU designates FRG between 1949 and 1989
Germany unified (DEU) has data since 1991
Author(s)
AGTPA authors, adapted from The World Development Index made by The World Bank
Application 1 (Traditional Gravity Estimates) Reporting Style
Description
Computes clustered standard errors, tests on coefficients with clustered standard errors and obtains RESET test p-value.
Usage
tp_summary_app_1(
  formula,
  data,
  method = "ppml",
  pair = "pair_id",
  etfe = "exp_year",
  itfe = "imp_year"
)
Arguments
formula | 
 Formula for the model  | 
data | 
 Tibble or data.frame  | 
method | 
 Regression method, which can be "ols" or "ppml" (default)  | 
pair | 
 Inter-national fixed effects column (defaults to "pair_id")  | 
etfe | 
 Exporter time fixed effects column (defaults to "exp_year")  | 
itfe | 
 Importer time fixed effects column (defaults to "imp_year")  | 
Value
A list
Examples
# See the ebook
Application 2 (The "Distance Puzzle" Resolved) Reporting Style
Description
Computes clustered standard errors, tests on coefficients with clustered standard errors and uses the delta method to obtain changes in time-based distance estimated coefficients.
Usage
tp_summary_app_2(
  formula,
  data,
  method = "ppml",
  pair = "pair_id",
  etfe = "exp_year",
  itfe = "imp_year",
  dist = "log_dist",
  intr = "log_dist_intra",
  csfe = "intra_pair"
)
Arguments
formula | 
 Formula for the model  | 
data | 
 Tibble or data.frame  | 
method | 
 Regression method (lm or glm)  | 
pair | 
 Inter-national fixed effects column (defaults to "pair_id")  | 
etfe | 
 Exporter time fixed effects column (defaults to "exp_year")  | 
itfe | 
 Importer time fixed effects column (defaults to "imp_year")  | 
dist | 
 Distance column (defaults to "log_dist")  | 
intr | 
 Intra-national distance column (defaults to "log_dist_intra")  | 
csfe | 
 Country-specific fixed effects (defaults to "intra_pair")  | 
Value
A list
Examples
# See the ebook
Application 3 (Regional Trade Agreements Effects) Reporting Style
Description
Computes clustered standard errors, tests on coefficients with clustered standard errors and returns total RTAs effect with its associated standard error.
Usage
tp_summary_app_3(
  formula,
  data,
  method = "ppml",
  pair = "pair_id",
  pair2 = "pair_id_2",
  etfe = "exp_year",
  itfe = "imp_year",
  dist = "log_dist",
  intr = "log_dist_intra",
  brdr = "intl_brdr"
)
Arguments
formula | 
 Formula for the model  | 
data | 
 Tibble or data.frame  | 
method | 
 Regression method, which can be "ols" or "ppml" (default)  | 
pair | 
 Inter-national fixed effects column (defaults to "pair_id")  | 
pair2 | 
 Intra-national fixed effects column (defaults to "pair_id_2")  | 
etfe | 
 Exporter time fixed effects column (defaults to "exp_year")  | 
itfe | 
 Importer time fixed effects column (defaults to "imp_year")  | 
dist | 
 Distance column (defaults to "log_dist")  | 
intr | 
 Intra-national distance column (defaults to "log_dist_intra")  | 
brdr | 
 Inter-national borders column (defaults to "intl_brdr")  | 
Value
A list
Examples
# See the ebook