Countries with EDB bureau

We collected a list of countries with special agencies or bureaus dedicated to tracking EDB requirements, progress, and reforms. This list comes from page 22 in the 2015 EDB report.

Modify original Stata data

Clean and munge the master Stata file.

edb_clean <- read_dta(file.path(here(), "data_raw", "MasterWBMarch16_15.dta")) %>%
  zap_formats() %>% zap_labels() %>%
  # Filter and select a subset of the original data
  filter(year > 1999) %>%
  rename(p_edb_rank = p_ebd_rank) %>%
  select(ccode, economy, year, 
         sb_proced, sb_days, sb_capital, sb_cost, con_proced, con_days,
         contains("_reform"),
         gdp, gdpcap, pop, gdpgrowth, polity = polity2, ibrd,
         inttot, civtot, p_edb_rank, yrsoffc, icrg_index, fdi_inper, trade) %>%
  # Add standardized country names from countrycode
  mutate(ccode = case_when(
    .$ccode == 730 ~ 732,  # Change South Korea's ccode to 732 instead of pre-war unified Korea's 730
    .$ccode == 1002 ~ 402,  # Cabo Verde has a real COW code
    TRUE ~ .$ccode
  )) %>% 
  mutate(country_name = countrycode(ccode, "cown", "country.name",
                                    custom_match = c(`1001` = "Serbia",
                                                     `1003` = "Puerto Rico", 
                                                     `1004` = "Palestinian Territories", 
                                                     `1005` = "Hong Kong SAR China")),
         # Use 345 for Serbia, but change it after creating country_name so it's not Yugoslavia
         ccode = ifelse(ccode == 1001, 345, ccode)) %>% 
  mutate_at(vars(ccode, year), funs(as.integer)) %>% 
  # Make variable indicating if country has a reform bureau
  mutate(has_bureau = ccode %in% edb_bureau$cowcode,
         has_bureau = factor(has_bureau, 
                             levels = c(FALSE, TRUE),
                             labels = c("No EDB reform committee", 
                                        "Special EDB reform committee")),
         ranked = !is.na(p_edb_rank)) %>%
  # Log variables
  mutate_at(vars(starts_with("sb"), starts_with("con"), 
                 gdp, gdpcap, pop, -contains("_reform")),
            funs(ln = log1p(.))) %>%
  # Center around different years for interrupted time series models
  mutate(year_centered_2003 = year - 2003,
         year_centered_2004 = year - 2004,
         year_centered_2005 = year - 2005,
         year_centered_2006 = year - 2006,
         year_centered_2007 = year - 2007,
         year_centered_2008 = year - 2008,
         year_centered_2009 = year - 2009,
         year_centered_2010 = year - 2010,
         year_centered_2011 = year - 2011,
         year_centered_2012 = year - 2012,
         year_centered_2013 = year - 2013,
         ranked_2003 = year_centered_2003 >= 0,
         ranked_2004 = year_centered_2004 >= 0,
         ranked_2005 = year_centered_2005 >= 0,
         ranked_2006 = year_centered_2006 >= 0,
         ranked_2007 = year_centered_2007 >= 0,
         ranked_2008 = year_centered_2008 >= 0,
         ranked_2009 = year_centered_2009 >= 0,
         ranked_2010 = year_centered_2010 >= 0,
         ranked_2011 = year_centered_2011 >= 0,
         ranked_2012 = year_centered_2012 >= 0,
         ranked_2013 = year_centered_2013 >= 0)  %>%
  # Lag variables within countries
  group_by(ccode) %>%
  mutate(loan_ln = log1p(sum(ibrd, na.rm = TRUE)),
         loan_bin = loan_ln > 0) %>%
  mutate_all(funs(lag = lag(.))) %>%
  # Normalize rankings within years
  group_by(year) %>%
  mutate(p_edb_rank_normalized = normalize(p_edb_rank)) %>%
  ungroup()

# Create variables indicating if a country is included in the 2001 or 2004 report
edb_its_constrained_countries <- edb_clean %>%
  mutate(in_report_in_2004 = year == 2004 & !is.na(sb_days),
         in_report_in_2001 = year == 2001 & !is.na(sb_days)) %>%
  group_by(ccode) %>%
  summarise(in_2004 = sum(in_report_in_2004),
            in_2001 = sum(in_report_in_2001))

# Add in_2001 and in_2004 to final data
edb_clean_final <- edb_clean %>%
  left_join(edb_its_constrained_countries, by = "ccode")

# Save cleaned data
write_rds(edb_clean_final, file.path(here(), "output", "data", "edb_clean.rds"))
write_csv(edb_clean_final, file.path(here(), "output", "data", "edb_clean.csv"))
write_dta(edb_clean_final, file.path(here(), "output", "data", "edb_clean.dta"))
## Warning in FUN(X[[i]], ...): NAs introduced by coercion to integer range

## Warning in FUN(X[[i]], ...): NAs introduced by coercion to integer range

## Warning in FUN(X[[i]], ...): NAs introduced by coercion to integer range

## Warning in FUN(X[[i]], ...): NAs introduced by coercion to integer range
LS0tCnRpdGxlOiAi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ZW1vY3JhdGljIFJlcHVibGljIG9mIENvbmdvIiwKICAgICJSZXB1YmxpYyBvZiBDb25nbyIsCiAgICAiQ290ZSBkJ0l2b2lyZSIsCiAgICAiR3VpbmVhIiwKICAgICJLZW55YSIsCiAgICAiTGliZXJpYSIsCiAgICAiTWFsYXdpIiwKICAgICJNYWxpIiwKICAgICJOaWdlcmlhIiwKICAgICJSd2FuZGEiLAogICAgIlNpZXJyYSBMZW9uZSIsCiAgICAiVG9nbyIsCiAgICAiWmFtYmlhIiwKICAgICJDaGlsZSIsCiAgICAiQ29sb21iaWEiLAogICAgIkNvc3RhIFJpY2EiLAogICAgIkRvbWluaWNhbiBSZXB1YmxpYyIsCiAgICAiR3VhdGVtYWxhIiwKICAgICJNZXhpY28iLAogICAgIlBhbmFtYSIsCiAgICAiUGVydSIKICApCgojIFN0YW5kYXJkaXplIGNvdW50cnkgbmFtZXMgYW5kIGNvZGVzCmVkYl9idXJlYXUgPC0gZGF0YV9mcmFtZShjb3VudHJ5X25hbWVfcmF3ID0gY291bnRyaWVzX3dpdGhfZWRiX29mZmljZSwKICAgICAgICAgICAgICAgICAgICAgICAgIElTTzMgPSBjb3VudHJ5Y29kZShjb3VudHJ5X25hbWVfcmF3LCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY291bnRyeS5uYW1lIiwgImlzbzNjIiksCiAgICAgICAgICAgICAgICAgICAgICAgICBjb3djb2RlID0gY291bnRyeWNvZGUoY291bnRyeV9uYW1lX3JhdywgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNvdW50cnkubmFtZSIsICJjb3duIiksCiAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5ID0gY291bnRyeWNvZGUoY291bnRyeV9uYW1lX3JhdywgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNvdW50cnkubmFtZSIsICJjb3VudHJ5Lm5hbWUiKSkgJT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ICAgIGdkcCwgZ2RwY2FwLCBwb3AsIGdkcGdyb3d0aCwgcG9saXR5ID0gcG9saXR5MiwgaWJyZCwKICAgICAgICAgaW50dG90LCBjaXZ0b3QsIHBfZWRiX3JhbmssIHlyc29mZmMsIGljcmdfaW5kZXgsIGZkaV9pbnBlciwgdHJhZGUpICU+JQogICMgQWRkIHN0YW5kYXJkaXplZCBjb3VudHJ5IG5hbWVzIGZyb20gY291bnRyeWNvZGUKICBtdXRhdGUoY2NvZGUgPSBjYXNlX3doZW4oCiAgICAuJGNjb2RlID09IDczMCB+IDczMiwgICMgQ2hhbmdlIFNvdXRoIEtvcmVhJ3MgY2NvZGUgdG8gNzMyIGluc3RlYWQgb2YgcHJlLXdhciB1bmlmaWVkIEtvcmVhJ3MgNzMwCiAgICAuJGNjb2RlID09IDEwMDIgfiA0MDIsICAjIENhYm8gVmVyZGUgaGFzIGEgcmVhbCBDT1cgY29kZQogICAgVFJVRSB+IC4kY2NvZGUKICApKSAlPiUgCiAgbXV0YXRlKGNvdW50cnlfbmFtZSA9IGNvdW50cnljb2RlKGNjb2RlLCAiY293biIsICJjb3VudHJ5Lm5hbWUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21fbWF0Y2ggPSBjKGAxMDAxYCA9ICJTZXJiaWEiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAxMDAzYCA9ICJQdWVydG8gUmljbyIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAxMDA0YCA9ICJQYWxlc3RpbmlhbiBUZXJyaXRvcmllcyIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAxMDA1YCA9ICJIb25nIEtvbmcgU0FSIENoaW5hIikpLAogICAgICAgICAjIFVzZSAzNDUgZm9yIFNlcmJpYSwgYnV0IGNoYW5nZSBpdCBhZnRlciBjcm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