library(MASS)  # Has to come first because of dplyr::select
library(tidyverse)
library(stargazer)

# By default, R uses polynomial contrasts for ordered factors in linear models
# options("contrasts") 
# So make ordered factors use treatment contrasts instead
options(contrasts=rep("contr.treatment", 2))

source("_functions.R")
df.cho <- readRDS("data/df_cho_full.rds") %>%
  filter(year > 2002, year < 2010) %>%
  mutate(cowcode.i = as.factor(cowcode), year.i = as.factor(year))

Replication of Seo-Young Cho, Axel Dreher, and Eric Neumayer. 2014. “Determinants of Anti-Trafficking Policies: Evidence from a New Index.” The Scandinavian Journal of Economics 116, no. 2 (April): 429–54. doi: 10.1111/sjoe.12055.

Model details

  • DV = 3P variables
  • Pooled time-series cross-section (panel) data from 2002–2010 (but 2010 is excluded, according to footnote 20)
  • Robust standard errors clustered at country level
  • Temporal lag of dependent variable
  • Country and year fixed effects
  • Ordered probit, OLS, and system GMM models
  • Variables:
    • Control of corruption (Kaufmann 2009), ranges from -1.63 (high corruption) to 2.58 (low corruption)
    • Lagged Polity
    • Women legislators (percent) - World Bank Gender Statistics database
    • Women economic rights - CIRI
    • International regime membership - binary indicator for Palermo protocol ratification
    • Log GDP/capita - World Bank, presumably
    • US aid as % of GDP - somewhere

Table 3: Anti-trafficking policies in aggregate

Original models

(Uses ordered probit, OLS, and GMM)

Table 3 from original article

Table 3 from original article

Replicated models

orig3.2 <- polr(as.ordered(p) ~ p_lag + corruption + polity + female.leg.prop + wecon + 
                  palermo.ratified + gdp.capita_log + us.aid.pct.gdp + year.i, 
                data = df.cho, method = "probit", Hess = TRUE)

orig3.3 <- lm(p ~ p_lag + corruption + polity + female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + year.i, 
              data = df.cho)

orig3.4 <- lm(p ~ p_lag + corruption + polity + female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + 
                cowcode.i + year.i, 
              data = df.cho)

orig3.6 <- lm(p ~ p_lag + corruption + polity + female.leg.prop + wecon + 
                cowcode.i + year.i, 
              data = df.cho)
models <- list(orig3.2, orig3.3, orig3.4, orig3.6)

var.labs <- c("3P index (t − 1)", "Control of corruption", "Democracy", 
              "Women legislators (%)", "Women economic rights",
              "Palermo Protocol ratified", "GDP per capita (log)", 
              "US aid (% of GDP)")

col.labs <- sprintf("(%s)", c(2, 3, 4, 6))

extra.lines <- list(c("Model type",
                      c("Ordered probit", "OLS", "OLS", "OLS")),
                    c("Country fixed effects",
                      c("No", "No", "Yes", "Yes")),
                    c("Year fixed effects",
                      c("Yes", "Yes", "Yes", "Yes")),
                    c("Pseudo R²",
                      c(round(pR2(orig3.2)[["McFadden"]], 3)), "", "", ""))

title <- "Replicated models from Table 3 (GMM models omitted)"

stargazer(models, 
          type = "html", omit = c("cow", "Constant", "year"), 
          add.lines = extra.lines, title = title, covariate.labels = var.labs,
          keep.stat = c("n", "adj.rsq"),
          model.numbers = FALSE, column.labels = col.labs, 
          dep.var.caption = "Aggregate 3P index",
          model.names = FALSE, dep.var.labels.include = FALSE)
Replicated models from Table 3 (GMM models omitted)
Aggregate 3P index
(2) (3) (4) (6)
3P index (t − 1) 0.612*** 0.752*** 0.284*** 0.291***
(0.022) (0.021) (0.032) (0.032)
Control of corruption 0.124** 0.114 0.614** 0.663**
(0.063) (0.076) (0.305) (0.298)
Democracy 0.025*** 0.034*** -0.056* -0.059*
(0.007) (0.009) (0.031) (0.031)
Women legislators (%) 0.004 0.006* -0.008 -0.008
(0.003) (0.003) (0.005) (0.005)
Women economic rights 0.124** 0.137* 0.146 0.131
(0.059) (0.072) (0.094) (0.093)
Palermo Protocol ratified 0.111 0.135 0.160
(0.076) (0.094) (0.156)
GDP per capita (log) 0.038 0.027 0.776
(0.040) (0.049) (0.580)
US aid (% of GDP) 3.187 3.202 4.050
(2.917) (3.607) (5.436)
Model type Ordered probit OLS OLS OLS
Country fixed effects No No Yes Yes
Year fixed effects Yes Yes Yes Yes
Pseudo R² 0.435
Observations 946 946 946 965
Adjusted R2 0.774 0.823 0.830
Note: p<0.1; p<0.05; p<0.01


Table 4: Anti-trafficking policy components

Original models

(Uses only GMM)

Table 4 from original article

Table 4 from original article

Replicated models

orig4.1 <- lm(prevention ~ prevention_lag + corruption + polity + 
                female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + 
                year.i + cowcode.i, 
              data = df.cho)

orig4.2 <- lm(prevention ~ prevention_lag + corruption + polity + 
                female.leg.prop + wecon + 
                year.i + cowcode.i,
              data = df.cho)

orig4.3 <- lm(prosecution ~ prosecution_lag + corruption + polity + 
                female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + 
                year.i + cowcode.i, 
              data = df.cho)

orig4.4 <- lm(prosecution ~ prosecution_lag + corruption + polity + 
                female.leg.prop + wecon + 
                year.i + cowcode.i,
              data = df.cho)

orig4.5 <- lm(prosecution ~ prosecution_lag + prosecution_lag2 + corruption + polity + 
                female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + 
                year.i + cowcode.i, 
              data = df.cho)

orig4.6 <- lm(prosecution ~ prosecution_lag + prosecution_lag2 + corruption + polity + 
                female.leg.prop + wecon + 
                year.i + cowcode.i,
              data = df.cho)

orig4.7 <- lm(protection ~ protection_lag + corruption + polity + 
                female.leg.prop + wecon + 
                palermo.ratified + gdp.capita_log + us.aid.pct.gdp + 
                year.i + cowcode.i, 
              data = df.cho)

orig4.8 <- lm(protection ~ protection_lag + corruption + polity + 
                female.leg.prop + wecon + 
                year.i + cowcode.i,
              data = df.cho)
models <- list(orig4.1, orig4.2, orig4.3, orig4.4,
               orig4.5, orig4.6, orig4.7, orig4.8)

num.models <- length(models)

var.labs <- c("Prevention (t − 1)", "Prosecution (t − 1)",
              "Prosecution (t − 2)", "Protection (t − 1)",
              "Control of corruption", "Democracy", 
              "Women legislators (%)", "Women economic rights",
              "Palermo Protocol ratified", "GDP per capita (log)", 
              "US aid (% of GDP)")

col.labs <- sprintf("(%s)", 1:num.models)

extra.lines <- list(c("Model type",
                      rep("OLS", num.models)),
                    c("Country fixed effects",
                      rep("Yes", num.models)),
                    c("Year fixed effects",
                      rep("Yes", num.models)))

title <- "Replicated models from Table 4 (OLS instead of GMM)"

stargazer(models, 
          type = "html", omit = c("cow", "Constant", "year"), 
          add.lines = extra.lines, title = title, covariate.labels = var.labs,
          keep.stat = c("n", "adj.rsq"),
          model.numbers = FALSE, column.labels = col.labs, 
          dep.var.caption = "Aggregate 3P index",
          model.names = FALSE, dep.var.labels.include = FALSE)
Replicated models from Table 4 (OLS instead of GMM)
Aggregate 3P index
(1) (2) (3) (4) (5) (6) (7) (8)
Prevention (t − 1) 0.143*** 0.145***
(0.035) (0.034)
Prosecution (t − 1) 0.311*** 0.314*** 0.286*** 0.289***
(0.033) (0.033) (0.037) (0.036)
Prosecution (t − 2) -0.055 -0.055
(0.035) (0.035)
Protection (t − 1) 0.182*** 0.190***
(0.034) (0.034)
Control of corruption 0.294* 0.331** 0.168 0.183 0.125 0.159 0.176 0.190
(0.152) (0.148) (0.157) (0.153) (0.165) (0.161) (0.162) (0.159)
Democracy 0.007 0.005 -0.026 -0.027* -0.024 -0.024 -0.036** -0.036**
(0.016) (0.016) (0.016) (0.016) (0.016) (0.016) (0.017) (0.017)
Women legislators (%) -0.002 -0.002 -0.004 -0.004 -0.004 -0.004 -0.002 -0.002
(0.003) (0.003) (0.003) (0.003) (0.003) (0.003) (0.003) (0.003)
Women economic rights 0.084* 0.071 0.061 0.059 0.046 0.043 -0.007 -0.007
(0.047) (0.046) (0.048) (0.048) (0.050) (0.049) (0.050) (0.050)
Palermo Protocol ratified 0.113 0.011 0.024 0.052
(0.077) (0.080) (0.084) (0.083)
GDP per capita (log) 0.506* 0.261 0.277 0.071
(0.287) (0.300) (0.319) (0.305)
US aid (% of GDP) 4.119 0.983 2.824 -1.181
(2.720) (2.799) (2.938) (2.905)
Model type OLS OLS OLS OLS OLS OLS OLS OLS
Country fixed effects Yes Yes Yes Yes Yes Yes Yes Yes
Year fixed effects Yes Yes Yes Yes Yes Yes Yes Yes
Observations 947 966 948 967 878 894 952 971
Adjusted R2 0.642 0.658 0.769 0.778 0.767 0.777 0.685 0.690
Note: p<0.1; p<0.05; p<0.01
LS0tCnRpdGxlOiAiUmVwbGljYXRpb24iCmRhdGU6ICJgciBmb3JtYXQoU3lzLnRpbWUoKSwgJyVGJylgIgotLS0KCmBgYHtyIHNldHVwLCBpbmNsdWRlPUZBTFNFfQprbml0cjo6b3B0c19jaHVuayRzZXQoZmlnLnJldGluYSA9IDIsCiAgICAgICAgICAgICAgICAgICAgICB0aWR5Lm9wdHM9bGlzdCh3aWR0aC5jdXRvZmYgPSAxMDApLCAgIyBGb3IgY29kZQogICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucyh3aWR0aCA9IDEwMCkpICAjIEZvciBvdXRwdXQKYGBgCgpgYGB7ciBsb2FkLWxpYnJhcmllcywgbWVzc2FnZT1GQUxTRX0KbGlicmFyeShNQVNTKSAgIyBIYXMgdG8gY29tZSBmaXJzdCBiZWNhdXNlIG9mIGRwbHlyOjpzZWxlY3QKbGlicmFyeSh0aWR5dmVyc2UpCmxpYnJhcnkoc3RhcmdhemVyKQoKIyBCeSBkZWZhdWx0LCBSIHVzZXMgcG9seW5vbWlhbCBjb250cmFzdHMgZm9yIG9yZGVyZWQgZmFjdG9ycyBpbiBsaW5lYXIgbW9kZWxzCiMgb3B0aW9ucygiY29udHJhc3RzIikgCiMgU28gbWFrZSBvcmRlcmVkIGZhY3RvcnMgdXNlIHRyZWF0bWVudCBjb250cmFzdHMgaW5zdGVhZApvcHRpb25zKGNvbnRyYXN0cz1yZXAoImNvbnRyLnRyZWF0bWVudCIsIDIpKQoKc291cmNlKCJfZnVuY3Rpb25zLlIiKQpgYGAKCmBgYHtyIGxvYWQtZGF0YX0KZGYuY2hvIDwtIHJlYWRSRFMoImRhdGEvZGZfY2hvX2Z1bGwucmRzIikgJT4lCiAgZmlsdGVyKHllYXIgPiAyMDAyLCB5ZWFyIDwgMjAxMCkgJ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GluZXMgPC0gbGlzdChjKCJNb2RlbCB0eXBlIiwKICAgICAgICAgICAgICAgICAgICAgIGMoIk9yZGVyZWQgcHJvYml0IiwgIk9MUyIsICJPTFMiLCAiT0xTIikpLAogICAgICAgICAgICAgICAgICAgIGMoIkNvdW50cnkgZml4ZWQgZWZmZWN0cyIsCiAgICAgICAgICAgICAgICAgICAgICBjKCJObyIsICJObyIsICJZZXMiLCAiWWVzIikpLAogICAgICAgICAgICAgICAgICAgIGMoIlllYXIgZml4ZWQgZWZmZWN0cyIsCiAgICAgICAgICAgICAgICAgICAgICBjKCJZZXMiLCAiWWVzIiwgIlllcyIsICJZZXMiKSksCiAgICAgICAgICAgICAgICAgICAgYygiUHNldWRvIFLCsiIsCiAgICAgICAgICAgICAgICAgICAgICBjKHJvdW5kKHBSMihvcmlnMy4yKVtbIk1jRmFkZGVuIl1dLCAzKSksICIiLCAiIiwgIiIpKQoKdGl0bGUgPC0gIlJlcGxpY2F0ZWQgbW9kZWxzIGZyb20gVGFibGUgMyAoR01NIG1vZGVscyBvbWl0dGVkKSIKCnN0YXJnYXplcihtb2RlbHMsIAogICAgICAgICAgdHlwZSA9ICJodG1sIiwgb21pdCA9IGMoImNvdyIsICJDb25zdGFudCIsICJ5ZWFyIiksIAogICAgICAgICAgYWRkLmxpbmVzID0gZXh0cmEubGluZXMsIHRpdGxlID0gdGl0bGUsIGNvdmFyaWF0ZS5sYWJlbHMgPSB2YXIubGFicywKICAgICAgICAgIGtlZXAuc3RhdCA9IGMoIm4iLCAiYWRqLnJzcSIpLAogICAgICAgICAgbW9kZWwubnVtYmVycyA9IEZBTFNFLCBjb2x1bW4ubGFiZWxzID0gY29sLmxhYnMsIAogICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIkFnZ3JlZ2F0ZSAzUCBpbmRleCIsCiAgICAgICAgICBtb2RlbC5uYW1lcyA9IEZBTFNFLCBkZXAudmFyLmxhYmVscy5pbmNsdWRlID0gRkFMU0UpCmBgYAogClwKCgojIy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F0YSA9IGRmLmNobykKCm9yaWc0LjQgPC0gbG0ocHJvc2VjdXRpb24gfiBwcm9zZWN1dGlvbl9sYWcgKyBjb3JydXB0aW9uICsgcG9saXR5ICsgCiAgICAgICAgICAgICAgICBmZW1hbGUubGVnLnByb3AgKyB3ZWNvbiArIAogICAgICAgICAgICAgICAgeWVhci5pICsgY293Y29kZS5pLAogICAgICAgICAgICAgIGRhdGEgPSBkZi5jaG8pCgpvcmlnNC41IDwtIGxtKHByb3NlY3V0aW9uIH4gcHJvc2VjdXRpb25fbGFnICsgcHJvc2VjdXRpb25fbGFnMiArIGNvcnJ1cHRpb24gKyBwb2xpdHkgKyAKICAgICAgICAgICAgICAgIGZlbWFsZS5sZWcucHJvcCArIHdlY29uICsgCiAgICAgICAgICAgICAgICBwYWxlcm1vLnJhdGlmaWVkICsgZ2RwLmNhcGl0YV9sb2cgKyB1cy5haWQucGN0LmdkcCArIAogICAgICAgICAgICAgICAgeWVhci5pICsgY293Y29kZS5pLCAKICAgICAgICAgICAgICBkYXRhID0gZGYuY2hvKQoKb3JpZzQuNiA8LSBsbShwcm9zZWN1dGlvbiB+IHByb3NlY3V0aW9uX2xhZyArIHByb3NlY3V0aW9uX2xhZzIgKyBjb3JydXB0aW9uICsgcG9saXR5ICsgCiAgICAgICAgICAgICAgICBmZW1hbGUubGVnLnByb3AgKyB3ZWNvbiArIAogICAgICAgICAgICAgICAgeWVhci5pICsgY293Y29kZS5pLAogICAgICAgICAgICAgIGRhdGEgPSBkZi5jaG8pCgpvcmlnNC43IDwtIGxtKHByb3RlY3Rpb24gfiBwcm90ZWN0aW9uX2xhZyArIGNvcnJ1cHRpb24gKyBwb2xpdHkgKyAKICAgICAgICAgICAgICAgIGZlbWFsZS5sZWcucHJvcCArIHdlY29uICsgCiAgICAgICAgICAgICAgICBwYWxlcm1vLnJhdGlmaWVkICsgZ2RwLmNhcGl0YV9sb2cgKyB1cy5haWQucGN0LmdkcCArIAogICAgICAgICAgICAgICAgeWVhci5pIC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ZXAoIk9MUyIsIG51bS5tb2RlbHMpKSwKICAgICAgICAgICAgICAgICAgICBjKCJDb3VudHJ5IGZpeGVkIGVmZmVjdHMiLAogICAgICAgICAgICAgICAgICAgICAgcmVwKCJZZXMiLCBudW0ubW9kZWxzKSksCiAgICAgICAgICAgICAgICAgICAgYygiWWVhciBmaXhlZCBlZmZlY3RzIiwKICAgICAgICAgICAgICAgICAgICAgIHJlcCgiWWVzIiwgbnVtLm1vZGVscykpKQoKdGl0bGUgPC0gIlJlcGxpY2F0ZWQgbW9kZWxzIGZyb20gVGFibGUgNCAoT0xTIGluc3RlYWQgb2YgR01NKSIKCnN0YXJnYXplcihtb2RlbHMsIAogICAgICAgICAgdHlwZSA9ICJodG1sIiwgb21pdCA9IGMoImNvdyIsICJDb25zdGFudCIsICJ5ZWFyIiksIAogICAgICAgICAgYWRkLmxpbmVzID0gZXh0cmEubGluZXMsIHRpdGxlID0gdGl0bGUsIGNvdmFyaWF0ZS5sYWJlbHMgPSB2YXIubGFicywKICAgICAgICAgIGtlZXAuc3RhdCA9IGMoIm4iLCAiYWRqLnJzcSIpLAogICAgICAgICAgbW9kZWwubnVtYmVycyA9IEZBTFNFLCBjb2x1bW4ubGFiZWxzID0gY29sLmxhYnMsIAogICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIkFnZ3JlZ2F0ZSAzUCBpbmRleCIsCiAgICAgICAgICBtb2RlbC5uYW1lcyA9IEZBTFNFLCBkZXAudmFyLmxhYmVscy5pbmNsdWRlID0gRkFMU0UpCmBgYAo=