Variable descriptions

Description of variables used in analysis
Variable Definition Source
sb_days Number of days required to start a business World Bank
sb_cost Cost (% of income per capita) of starting a business World Bank
sb_capital Paid-in minimum capital (% of income per capita) required to start a business World Bank
sb_proced Number of procedures required for an entrepreneur to legally operate a business World Bank
con_proced Number of procedures required to resolve a dispute World Bank
con_days Number of days required for the process of dispute resolution World Bank
gdp GDP (constant 2005 USD) World Development Indicators
gdpcap GDP per capita World Development Indicators
gdpgrowth GDP growth World Development Indicators
pop_ln Log of population World Development Indicators
polity Polity IV score Polity IV Project
inttot Magnitude of international conflict Center for Systemic Peace
civtot Magnitude of civil conflict Center for Systemic Peace
loan_ln Log of the sum of all loans from the IBRD since 2005, constant for all years

Variable summaries

The small inline histograms in this table will only display correctly when they use a font that supports block elements, such as DejaVu Sans or Arial.

Summary statistics of variables used in analysis
Variable N Mean Std. Dev Min Max Distribution
sb_days 2,368 39.55 52.8 0.5 697 ▇▁▁▁▁▁▁▁
sb_cost 2,368 57.27 123.1 0 1,540 ▇▁▁▁▁▁▁▁
sb_capital 2,258 114.2 434.5 0 7,445 ▇▁▁▁▁▁▁▁
sb_proced 2,368 8.55 3.474 1 20 ▂▃▇▅▃▂▁▁
con_proced 2,339 36.77 8.006 0 62 ▁▁▁▃▇▇▂▁
con_days 2,338 590.8 313.3 7 1,800 ▂▆▇▃▁▁▁▁
gdp 2,468 264,872,882,270 1,122,476,616,993 97,813,220 14,450,329,106,512 ▇▁▁▁▁▁▁▁
gdpcap 2,480 10,591 16,385 108 113,739 ▇▁▁▁▁▁▁▁
gdpgrowth 2,468 2.476 5.478 -62.47 102.8 ▁▁▂▇▁▁▁▁
pop_ln 2,512 15.56 2.068 9.861 21.03 ▁▂▂▆▇▅▂▁
polity 2,138 3.918 6.238 -10 10 ▁▂▁▂▁▂▃▇
inttot 2,182 0.06279 0.4875 0 6 ▇▁▁▁▁▁▁▁
civtot 2,182 0.4216 1.279 0 9 ▇▁▁▁▁▁▁▁
loan_ln 3,016 13.97 10.78 0 26.46 ▇▁▁▁▁▂▇▃

List of countries in initial 2001 report

* indicates country has an EDB reform committee by 2015

Countries in 2001 report
Albania Ecuador Madagascar Slovakia
Algeria* Egypt Malawi* Slovenia
Argentina Ethiopia Malaysia* South Africa
Armenia Finland Mali* South Korea*
Australia France Mexico* Spain
Austria Georgia* Moldova* Sri Lanka*
Azerbaijan* Germany Mongolia Sweden
Bangladesh Ghana Morocco* Switzerland
Belarus Greece Mozambique Syria
Belgium Guatemala* Nepal Taiwan
Benin Honduras Netherlands Tanzania
Bhutan Hong Kong SAR China New Zealand Thailand
Bolivia Hungary Nicaragua Tunisia
Bosnia & Herzegovina India Niger Turkey
Botswana* Indonesia* Nigeria* Uganda
Bulgaria Iran Norway Ukraine*
Burkina Faso Ireland Pakistan United Arab Emirates*
Cameroon Israel Panama* United Kingdom*
Canada Italy Peru* United States
Chile* Jamaica Philippines* Uruguay
China Japan Poland* Uzbekistan*
Colombia* Jordan Portugal Venezuela
Costa Rica* Kazakhstan* Romania Vietnam
Côte d’Ivoire* Kenya* Russia* Yemen
Croatia* Kyrgyzstan* Saudi Arabia* Zambia*
Czechia* Latvia Senegal Zimbabwe
Denmark Lebanon Serbia
Dominican Republic* Lithuania Singapore

How control variables relate to being in the sample and to the outcomes

Models A2–A5

# This function generates an R formula based on a given outcome and its lead. 
# Given "sb_days_ln", it will create and run "sb_days_ln_lead ~ sb_days_ln + ..."
run_leaded_ols_check <- function(outcome, df) {
  outcome_lead <- paste0(outcome, "_lead")
  
  form <- as.formula(paste0(outcome_lead, " ~ ", outcome, 
                          " + gdpcap_ln + gdpgrowth + polity + ", 
                          "pop_ln + inttot + civtot + loan_ln"))
  
  lm(form, data = df)
}

# Define all the models that need to be run
models_to_run <- data_frame(outcome = c("sb_days_ln", "sb_proced",
                                        "sb_cost_ln", "sb_capital_ln"),
                            grouping = 1)  # Temporary variable for joining

edb_checks <- edb_clean %>%
  filter(year > 2000, in_2001 == 1) %>%
  mutate(grouping = 1) %>%
  group_by(ccode) %>%
  mutate_at(vars(sb_days_ln, sb_proced, sb_cost_ln, sb_capital_ln),
            funs(lead = lead(.))) %>%
  group_by(grouping) %>%
  nest() %>%
  right_join(models_to_run, by = "grouping")

# Run all the models within the data frame
edb_checks_models <- edb_checks %>%
  mutate(model = pmap(.l = list(outcome, data), run_leaded_ols_check),
         # Add robust clustered SEs
         robust_se = pmap(.l = list(model, data, "ccode"), robust_clusterify),
         # Add a data frame of model parameters with correct SEs
         tidy_robust = robust_se %>% map(~ tidy(.$coef)),
         ses_only = tidy_robust %>% map(~ .$std.error))

edb_checks_models_out <- stargazer(edb_checks_models$model, type = "html", 
                                   dep.var.caption = "",
                                   se = edb_checks_models$ses_only,
                                   notes = c("OLS models. Robust standard errors clustered by country.",
                                             "Models include countries present in the 2001 EDB report."),
                                   keep.stat = c("n", "rsq", "adj.rsq"))
sb_days_ln_lead sb_proced_lead sb_cost_ln_lead sb_capital_ln_lead
(1) (2) (3) (4)
sb_days_ln 0.911***
(0.014)
sb_proced 0.929***
(0.015)
sb_cost_ln 0.941***
(0.010)
sb_capital_ln 0.915***
(0.011)
gdpcap_ln -0.025** -0.045 -0.051*** -0.042*
(0.011) (0.044) (0.013) (0.023)
gdpgrowth -0.007*** -0.020*** -0.014*** -0.004
(0.002) (0.007) (0.002) (0.006)
polity 0.0002 0.003 0.003* 0.012***
(0.001) (0.006) (0.001) (0.004)
pop_ln 0.011 0.074*** 0.011* 0.007
(0.007) (0.025) (0.006) (0.014)
inttot -0.006 0.039 0.011 -0.003
(0.015) (0.062) (0.010) (0.027)
civtot 0.006 0.021 0.003 -0.004
(0.005) (0.030) (0.007) (0.017)
loan_ln -0.001 0.002 -0.001 -0.003
(0.001) (0.006) (0.001) (0.003)
Constant 0.247 -0.533 0.359** 0.232
(0.168) (0.537) (0.166) (0.319)
Observations 1,310 1,310 1,310 1,209
R2 0.887 0.912 0.957 0.895
Adjusted R2 0.887 0.911 0.957 0.894
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2001 EDB report.

Starting a Business indicators

Not generated with this script.

Enforcing Contracts indicators

Not generated with this script.

Policy reform: OLS models

# Define all the models that need to be run
models_to_run <- expand.grid(year = 2003:2013,
                             outcome = c("sb_proced", "sb_days_ln",
                                         "sb_cost_ln", "sb_capital_ln"),
                             grouping = c("All countries", 
                                          "No EDB reform committee", 
                                          "Special EDB reform committee"),
                             stringsAsFactors = FALSE)

# As in the paper analysis, this function generates an R model formula based on
# the name of the dependent variable and the year provided. i.e., given
# "sb_proced" and "2005", it will create the formula "sb_proced ~ sb_proced_lag
# + ranked_2005" and run the model
run_lagged_ols_model <- function(outcome, year, df) {
  outcome_lag <- paste0(outcome, "_lag")
  year_variable <- paste0("ranked_", year)

  form <- as.formula(paste0(outcome, " ~ ", outcome_lag, " + ", year_variable))

  lm(form, data = df)
}

dfs_split <- edb_clean %>%
  filter(in_2001 == 1) %>%
  group_by(has_bureau) %>%
  nest() %>%
  mutate(has_bureau = as.character(has_bureau)) %>%
  rename(grouping = has_bureau)

df_all <- edb_clean %>%
  filter(in_2001 == 1) %>%
  mutate(grouping = "All countries") %>%
  group_by(grouping) %>%
  nest()

models_to_run_full <- bind_rows(dfs_split, df_all) %>%
  right_join(models_to_run, by = "grouping")

# Run all the models within the data frame
ols_models_lagged <- models_to_run_full %>%
  mutate(model = pmap(.l = list(outcome, year, data), run_lagged_ols_model),
         # Add robust clustered SEs
         robust_se = pmap(.l = list(model, data, "ccode"), robust_clusterify),
         # Add model summary statistics
         glance = model %>% map(glance),
         # Add a data frame of model parameters with correct SEs
         tidy_robust = robust_se %>% map(~ tidy(.$coef)),
         ses_only = tidy_robust %>% map(~ .$std.error))

# Extract the ranking coefficients from all models
ols_coefs <- ols_models_lagged %>%
  # Spread out the model results
  unnest(tidy_robust) %>%
  # Only look at the ranked* coefficients
  filter(str_detect(term, "ranked")) %>%
  # Clean up the estimates, labels, and add stars
  mutate(value = paste0(sprintf("%.3f", round(estimate, 3)), p_stars(p.value)),
         term = str_replace(term, "\\.\\d+TRUE", "")) %>%
  # Get rid of extra columns
  select(-c(estimate, std.error, statistic, p.value)) %>%
  spread(outcome, value) %>%
  # Give table clean column names
  select(Subset = grouping, Year = year,
         Procedures = sb_proced, `Cost (log)` = sb_cost_ln,
         `Days (log)` = sb_days_ln, `Capital (log)` = sb_capital_ln)

Table 3 from the paper: summary of coefficients for 8 OLS models

Full models in tables B1–3 below.

Summary of β2 coefficients (i.e. “ranked_200x”) for difference models
Subset Year Procedures Cost (log) Days (log) Capital (log)
All countries 2005 -0.176** -0.081*** -0.040* -0.030
All countries 2006 -0.240*** -0.071*** -0.049** -0.097*

Table B1: 2005 analysis, full OLS models

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4)
sb_proced_lag 0.939***
(0.013)
sb_days_ln_lag 0.922***
(0.012)
sb_cost_ln_lag 0.973***
(0.004)
sb_capital_ln_lag 0.915***
(0.011)
ranked_2005 -0.176** -0.040* -0.081*** -0.030
(0.078) (0.024) (0.022) (0.058)
Constant 0.365*** 0.180*** 0.053** 0.032
(0.110) (0.048) (0.025) (0.057)
Observations 1,427 1,427 1,427 1,318
R2 0.909 0.887 0.953 0.895
Adjusted R2 0.909 0.887 0.952 0.895
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2001 EDB report.

Table B2: 2006 analysis, full OLS models

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4)
sb_proced_lag 0.935***
(0.013)
sb_days_ln_lag 0.919***
(0.012)
sb_cost_ln_lag 0.973***
(0.004)
sb_capital_ln_lag 0.913***
(0.011)
ranked_2006 -0.240*** -0.049** -0.071*** -0.097*
(0.068) (0.022) (0.019) (0.052)
Constant 0.424*** 0.193*** 0.041* 0.087*
(0.113) (0.048) (0.022) (0.049)
Observations 1,427 1,427 1,427 1,318
R2 0.910 0.887 0.952 0.895
Adjusted R2 0.909 0.887 0.952 0.895
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2001 EDB report.

Table B3: Cutpoints at every possible year, OLS models

Summary of β2 coefficients (i.e. “ranked.200x”) for difference models for all years
Subset Year Procedures Cost (log) Days (log) Capital (log)
All countries 2003 -0.074 -0.114** 0.002
All countries 2004 -0.261*** -0.107*** -0.040 0.096
All countries 2005 -0.176** -0.081*** -0.040* -0.030
All countries 2006 -0.240*** -0.071*** -0.049** -0.097*
All countries 2007 -0.239*** -0.046*** -0.051** -0.126**
All countries 2008 -0.209*** -0.034** -0.040** -0.133***
All countries 2009 -0.110* -0.008 -0.007 -0.101**
All countries 2010 -0.060 0.002 0.005 -0.035
All countries 2011 -0.093 -0.024 -0.002 -0.073*
All countries 2012 -0.027 -0.015 0.008 -0.073*
All countries 2013 -0.108 -0.028 -0.014 -0.090*
No EDB reform committee 2003 -0.203 -0.112* 0.003
No EDB reform committee 2004 -0.246*** -0.097** -0.049 -0.045
No EDB reform committee 2005 -0.164** -0.079*** -0.038 -0.085
No EDB reform committee 2006 -0.201*** -0.069*** -0.035 -0.144**
No EDB reform committee 2007 -0.181*** -0.031 -0.040 -0.162***
No EDB reform committee 2008 -0.159** -0.014 -0.030 -0.178***
No EDB reform committee 2009 -0.031 0.007 0.006 -0.106**
No EDB reform committee 2010 0.031 0.012 0.019 -0.048
No EDB reform committee 2011 -0.005 -0.014 0.012 -0.087
No EDB reform committee 2012 0.049 0.000 0.023 -0.059
No EDB reform committee 2013 -0.010 -0.011 -0.006 -0.081
Special EDB reform committee 2003 0.147 -0.118* 0.002
Special EDB reform committee 2004 -0.334 -0.125*** -0.019 0.371*
Special EDB reform committee 2005 -0.244 -0.085** -0.042 0.076
Special EDB reform committee 2006 -0.370*** -0.074*** -0.077*** -0.010
Special EDB reform committee 2007 -0.416*** -0.074*** -0.071*** -0.060
Special EDB reform committee 2008 -0.375*** -0.072*** -0.059** -0.047
Special EDB reform committee 2009 -0.339** -0.038 -0.031 -0.098
Special EDB reform committee 2010 -0.316** -0.016 -0.022 -0.014
Special EDB reform committee 2011 -0.343** -0.045* -0.029 -0.048
Special EDB reform committee 2012 -0.249* -0.044 -0.016 -0.105
Special EDB reform committee 2013 -0.377** -0.061 -0.025 -0.112

Policy reform: ITS models

run_its_model <- function(outcome, year, df) {
  year_variable <- paste0("ranked_", year)
  year_centered <- paste0("year_centered_", year)
  
  form <- as.formula(paste0(outcome, " ~ ", year_centered, " + ", year_variable,
                            " + ", year_centered, " * ", year_variable))
  
  lm(form, data = df)
}

# Run all the models within the data frame
its_models_lagged <- models_to_run_full %>%
  mutate(model = pmap(.l = list(outcome, year, data), run_its_model),
         # Add robust clustered SEs
         robust_se = pmap(.l = list(model, data, "ccode"), robust_clusterify),
         # Add model summary statistics
         glance = model %>% map(glance),
         # Add a data frame of model parameters with correct SEs
         tidy_robust = robust_se %>% map(~ tidy(.$coef)),
         ses_only = tidy_robust %>% map(~ .$std.error))

# Extract the ranking coefficients from all models
its_coefs <- its_models_lagged %>%
  # Spread out the model results
  unnest(tidy_robust) %>%
  # Only look at the coefficients from interaction terms (they have ":" in their names)
  filter(str_detect(term, ":")) %>%
  # Clean up the estimates, labels, and add stars
  mutate(value = paste0(sprintf("%.3f", round(estimate, 3)), p_stars(p.value)),
         term = str_replace(term, "(.+)\\.\\d+:(.+)\\.\\d+TRUE", "\\1 × \\2")) %>%
  # Get rid of extra columns
  select(-c(estimate, std.error, statistic, p.value)) %>%
  spread(outcome, value) %>%
  # Give table clean column names
  select(Subset = grouping, Year = year,
         Procedures = sb_proced, `Cost (log)` = sb_cost_ln,
         `Days (log)` = sb_days_ln, `Capital (log)` = sb_capital_ln)

Table 4 from the paper: summary of coefficients for 8 ITS models

Full models in tables C1–3 below.

Summary of β3 coefficients (i.e. “year.centered.200x × ranked.200x”) for ITS models
Subset Year Procedures Cost (log) Days (log) Capital (log)
All countries 2005 -0.088 -0.059** 0.009 0.054
All countries 2006 -0.105 -0.041** 0.008 -0.019

Table C1: 2005 analysis, full ITS models

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4)
year_centered_2005 -0.256*** -0.108*** -0.037* -0.244***
(0.085) (0.019) (0.022) (0.052)
ranked_2005 0.010 -0.036 -0.135*** 0.236***
(0.142) (0.045) (0.044) (0.089)
year_centered_2005:ranked_2005 -0.088 0.009 -0.059** 0.054
(0.092) (0.022) (0.024) (0.059)
Constant 9.350*** 3.419*** 3.101*** 2.515***
(0.345) (0.078) (0.140) (0.244)
Observations 1,538 1,538 1,538 1,428
R2 0.130 0.235 0.076 0.088
Adjusted R2 0.128 0.233 0.074 0.087
Note: *p<0.1; **p<0.05; ***p<0.01
ITS models. Robust standard errors clustered by country.
Models include countries present in the 2001 EDB report.

Table C2: 2006 analysis, full ITS models

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4)
year_centered_2006 -0.228*** -0.101*** -0.048*** -0.170***
(0.068) (0.016) (0.017) (0.037)
ranked_2006 -0.242 -0.082* -0.185*** 0.040
(0.162) (0.048) (0.051) (0.101)
year_centered_2006:ranked_2006 -0.105 0.008 -0.041** -0.019
(0.077) (0.019) (0.019) (0.046)
Constant 9.203*** 3.336*** 3.020*** 2.518***
(0.349) (0.079) (0.138) (0.239)
Observations 1,538 1,538 1,538 1,428
R2 0.130 0.236 0.077 0.088
Adjusted R2 0.128 0.234 0.075 0.086
Note: *p<0.1; **p<0.05; ***p<0.01
ITS models. Robust standard errors clustered by country.
Models include countries present in the 2001 EDB report.

Table C3: Cutpoints at every possible year, ITS models

Summary of β3 coefficients (i.e. “year.centered.200x × ranked.200x”) for ITS models for all years
Subset Year Procedures Cost (log) Days (log) Capital (log)
All countries 2003 0.072 -0.094* 0.053
All countries 2004 -0.124 -0.085*** 0.011 0.200*
All countries 2005 -0.088 -0.059** 0.009 0.054
All countries 2006 -0.105 -0.041** 0.008 -0.019
All countries 2007 -0.077 -0.017 0.017 -0.033
All countries 2008 -0.025 0.002 0.032** -0.019
All countries 2009 0.028 0.014 0.047*** 0.012
All countries 2010 0.049 0.010 0.052*** 0.019
All countries 2011 0.081 0.011 0.055*** 0.019
All countries 2012 0.045 0.001 0.041** 0.002
All countries 2013 0.158** -0.006 0.043** -0.038
No EDB reform committee 2003 -0.042 -0.081 0.068
No EDB reform committee 2004 -0.127 -0.069 0.015 0.057
No EDB reform committee 2005 -0.084 -0.048 0.020 -0.010
No EDB reform committee 2006 -0.087 -0.031 0.027 -0.070
No EDB reform committee 2007 -0.045 -0.000 0.036 -0.070
No EDB reform committee 2008 0.017 0.021 0.053** -0.046
No EDB reform committee 2009 0.082 0.031* 0.068*** -0.003
No EDB reform committee 2010 0.108 0.027 0.073*** 0.011
No EDB reform committee 2011 0.140* 0.031 0.075*** 0.028
No EDB reform committee 2012 0.110 0.020 0.054** 0.015
No EDB reform committee 2013 0.137 -0.002 0.042 0.002
Special EDB reform committee 2003 0.318 -0.120* 0.025
Special EDB reform committee 2004 -0.117 -0.116*** 0.003 0.495**
Special EDB reform committee 2005 -0.097 -0.081** -0.015 0.188
Special EDB reform committee 2006 -0.141 -0.062** -0.029 0.085
Special EDB reform committee 2007 -0.143 -0.050** -0.023 0.043
Special EDB reform committee 2008 -0.113 -0.035* -0.009 0.037
Special EDB reform committee 2009 -0.085 -0.021 0.002 0.044
Special EDB reform committee 2010 -0.074 -0.025 0.007 0.036
Special EDB reform committee 2011 -0.040 -0.028 0.014 0.001
Special EDB reform committee 2012 -0.091 -0.039 0.014 -0.023
Special EDB reform committee 2013 0.202* -0.015 0.046* -0.120

Country fixed effects for OLS models

Table D1: “Ranked” coefficients with and without country fixed effects

# All the FE models to be run
country_fe_models <- expand.grid(outcome = c("sb_proced", "sb_days_ln",
                                             "sb_cost_ln", "sb_capital_ln",
                                             "con_proced", "con_days"),
                                 controls = c("Main", 
                                              "Main + `civtot_lag` + `inttot_lag` + `loan_ln_lag`", 
                                              "Main + `civtot_lag` + `inttot_lag` + `loan_bin_lag`", 
                                              "Main + fixed effects",
                                              "Main - 2001", "Main - 2001 & 2002"),
                                 stringsAsFactors = FALSE) %>%
  mutate(country_fe = controls %in% c("Main + fixed effects", "Main - 2001", "Main - 2001 & 2002"),
         df_to_use = case_when(
           controls == "Main - 2001" ~ "Drop 2001",
           controls == "Main - 2001 & 2002" ~ "Drop 2002",
           TRUE ~ "Full" 
         ))

# Nest filtered data into a data frame
data_to_use <- tribble(
  ~df_to_use,  ~data,
  "Full",      edb_clean %>% filter(year > 2000, in_2004 == 1),
  "Drop 2001", edb_clean %>% filter(year > 2001, in_2004 == 1),
  "Drop 2002", edb_clean %>% filter(year > 2002, in_2004 == 1)
)

# Combine filtered data with all model parameters
country_fe_models_full <- data_to_use %>%
  right_join(country_fe_models, by = "df_to_use") %>%
  select(-df_to_use)

# Build and run a bunch of different models based on parameters that determine
# what controls to add and whether or not to include country fixed effects
run_country_fe_models <- function(outcome, controls, country_fe, df) {
  main_controls <- "gdpcap_ln_lag + gdpgrowth_lag + polity_lag + pop_ln_lag"
  
  if (str_detect(controls, "loan_ln_lag")) {
    additional_controls <- " + civtot_lag + inttot_lag + loan_ln_lag"
  } else if (str_detect(controls, "loan_bin_lag")) {
    additional_controls <- " + civtot_lag + inttot_lag + loan_bin_lag"
  } else {
    additional_controls <- ""
  }
  
  if (country_fe) {
    country <- " + as.factor(ccode)"
  } else {
    country <- ""
  }

  form <- paste0(outcome, " ~ ", paste0(outcome, "_lag"), " + ranked_lag + ", 
                 main_controls, additional_controls, country) %>%
    as.formula()

  lm(form, data = df)
}

# Run all the models within the data frame
country_fe_models_all <- country_fe_models_full %>%
  mutate(model = pmap(.l = list(outcome, controls, country_fe, data), 
                      run_country_fe_models),
         # Add robust clustered SEs
         robust_se = pmap(.l = list(model, data, "ccode"), robust_clusterify),
         # Add model summary statistics
         glance = model %>% map(glance),
         # Add a data frame of model parameters with correct SEs
         tidy_robust = robust_se %>% map(~ tidy(.$coef)),
         ses_only = tidy_robust %>% map(~ .$std.error))

# Make tiny data frame indicating if model had country fixed effects
fixed_effects_country <- country_fe_models %>%
  select(controls, country_fe) %>%
  distinct() %>%
  mutate(country_fe = ifelse(country_fe, "Yes", "No")) %>%
  spread(controls, country_fe) %>%
  mutate(Outcome = "Fixed country effects")

# Display all the ranked coefficients
ranked_coefs_country <- country_fe_models_all %>%
  # Spread out the model results
  unnest(tidy_robust) %>%
  filter(str_detect(term, "ranked")) %>%
  # Clean up the estimates and add stars
  mutate(value = paste0(sprintf("%.3f", round(estimate, 3)), p_stars(p.value)),
         outcome = factor(outcome, levels = unique(country_fe_models$outcome),
                          labels = paste0("`", unique(country_fe_models$outcome), "`"),
                          ordered = TRUE),
         controls = factor(controls, levels = unique(country_fe_models$controls),
                           ordered = TRUE)) %>%
  # Get rid of extra columns
  select(Outcome = outcome, controls, value) %>%
  spread(controls, value) %>%
  bind_rows(fixed_effects_country)
Summary of coefficients for the lagged “Ranked” variable with and without country fixed effects
Outcome Main Main + civtot_lag + inttot_lag + loan_ln_lag Main + civtot_lag + inttot_lag + loan_bin_lag Main + fixed effects Main - 2001 Main - 2001 & 2002
sb_proced -0.233*** -0.247*** -0.251*** -0.237** -0.237** -0.225**
sb_days_ln -0.029 -0.027 -0.029 -0.061** -0.061** -0.057**
sb_cost_ln -0.074*** -0.078*** -0.079*** -0.064** -0.064** -0.046*
sb_capital_ln -0.003 0.005 0.003 -0.032 -0.032 -0.032
con_proced -1.339*** -1.293*** -1.279*** -0.045 -0.045 -0.204***
con_days -67.590*** -67.839*** -67.357*** -9.040* -9.040* -14.108**
Fixed country effects No No No Yes Yes Yes

Note: Main controls are gdpcap_ln_lag, gdpgrowth_lag, polity_lag, and pop_ln_lag

Table D2: Sub-indicators for “Starting a Business” with and without country fixed effects

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4) (5) (6) (7) (8)
sb_proced_lag 0.920*** 0.741***
(0.013) (0.026)
sb_days_ln_lag 0.931*** 0.751***
(0.011) (0.022)
sb_cost_ln_lag 0.948*** 0.695***
(0.009) (0.041)
sb_capital_ln_lag 0.924*** 0.742***
(0.009) (0.025)
ranked_lag -0.251*** -0.237** -0.029 -0.061** -0.079*** -0.064** 0.003 -0.032
(0.069) (0.096) (0.019) (0.029) (0.018) (0.029) (0.045) (0.063)
gdpcap_ln_lag -0.017 -0.420*** -0.015 -0.125*** -0.027** -0.232*** -0.030* -0.224**
(0.037) (0.152) (0.009) (0.043) (0.012) (0.044) (0.018) (0.106)
gdpgrowth_lag -0.021*** -0.008 -0.007*** -0.005*** -0.013*** -0.007*** -0.008 0.002
(0.006) (0.007) (0.002) (0.002) (0.002) (0.002) (0.005) (0.006)
polity_lag -0.005 -0.020 -0.002 -0.005 0.0004 -0.011* 0.004 0.018
(0.006) (0.018) (0.001) (0.005) (0.001) (0.006) (0.004) (0.019)
pop_ln_lag 0.041* -1.244** 0.006 -0.172 0.008 -0.416*** -0.009 -0.294
(0.024) (0.540) (0.006) (0.116) (0.005) (0.158) (0.012) (0.688)
civtot_lag 0.028 0.004 0.004 0.014
(0.026) (0.005) (0.006) (0.014)
inttot_lag 0.076* -0.004 0.031** -0.087
(0.041) (0.016) (0.012) (0.118)
loan_bin_lag 0.103 -0.006 0.036 -0.063
(0.119) (0.029) (0.032) (0.058)
Constant 0.038 30.747*** 0.204 5.258** 0.213 10.979*** 0.432* 7.993
(0.457) (10.189) (0.137) (2.340) (0.159) (3.055) (0.258) (12.806)
Country fixed effects No Yes No Yes No Yes No Yes
Observations 1,659 1,660 1,659 1,660 1,659 1,660 1,558 1,559
R2 0.909 0.926 0.902 0.919 0.963 0.970 0.904 0.918
Adjusted R2 0.909 0.919 0.902 0.911 0.963 0.968 0.903 0.910
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2004 EDB report.

Table D3: Sub-indicators for “Enforcing Contracts” with and without country fixed effects

con_proced con_days
(1) (2) (3) (4)
con_proced_lag 0.708*** 0.379***
(0.023) (0.027)
con_days_lag 0.903*** 0.451***
(0.015) (0.035)
ranked_lag -1.279*** -0.045 -67.357*** -9.040*
(0.258) (0.122) (5.427) (4.990)
gdpcap_ln_lag -0.383*** 0.200 -5.263 3.433
(0.145) (0.269) (3.237) (7.930)
gdpgrowth_lag -0.038 0.011 -2.627*** -0.920
(0.024) (0.015) (0.676) (0.589)
polity_lag -0.112*** 0.044 1.219** -0.785
(0.039) (0.048) (0.525) (1.765)
pop_ln_lag 0.023 -0.361 2.358 -48.999
(0.109) (1.008) (2.561) (33.737)
civtot_lag 0.208** 9.935**
(0.101) (4.295)
inttot_lag 0.292 -2.168
(0.393) (3.915)
loan_bin_lag -0.371 3.842
(0.487) (11.148)
Constant 15.702*** 24.570 124.001*** 1,127.757*
(2.421) (18.769) (42.007) (645.682)
Country fixed effects No Yes No Yes
Observations 1,634 1,635 1,633 1,634
R2 0.725 0.830 0.868 0.924
Adjusted R2 0.723 0.814 0.867 0.917
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2004 EDB report.

Year fixed effects for OLS models

Table E1: “Ranked” coefficients with and without year fixed effects

# All the FE models to be run
year_fe_models <- expand.grid(outcome = c("sb_proced", "sb_days_ln",
                                          "sb_cost_ln", "sb_capital_ln",
                                          "con_proced", "con_days"),
                              controls = c("Main", 
                                           "Main + `civtot_lag` + `inttot_lag` + `loan_ln_lag`", 
                                           "Main + `civtot_lag` + `inttot_lag` + `loan_bin_lag`", 
                                           "Main + fixed effects",
                                           "Main - 2001", "Main - 2001 & 2002"),
                              stringsAsFactors = FALSE) %>%
  mutate(year_fe = controls %in% c("Main + fixed effects", "Main - 2001", "Main - 2001 & 2002"),
         df_to_use = case_when(
           controls == "Main - 2001" ~ "Drop 2001",
           controls == "Main - 2001 & 2002" ~ "Drop 2002",
           TRUE ~ "Full" 
         ))

# Nest filtered data into a data frame
data_to_use <- tribble(
  ~df_to_use,  ~data,
  "Full",      edb_clean %>% filter(year > 2000, in_2004 == 1),
  "Drop 2001", edb_clean %>% filter(year > 2001, in_2004 == 1),
  "Drop 2002", edb_clean %>% filter(year > 2002, in_2004 == 1)
)

# Combine filtered data with all model parameters
year_fe_models_full <- data_to_use %>%
  right_join(year_fe_models, by = "df_to_use") %>%
  select(-df_to_use)

# Build and run a bunch of different models based on parameters that determine
# what controls to add and whether or not to include country fixed effects
run_year_fe_models <- function(outcome, controls, year_fe, df) {
  main_controls <- "gdpcap_ln_lag + gdpgrowth_lag + polity_lag + pop_ln_lag"
  
  if (str_detect(controls, "loan_ln_lag")) {
    additional_controls <- " + civtot_lag + inttot_lag + loan_ln_lag"
  } else if (str_detect(controls, "loan_bin_lag")) {
    additional_controls <- " + civtot_lag + inttot_lag + loan_bin_lag"
  } else {
    additional_controls <- ""
  }
  
  if (year_fe) {
    year <- " + as.factor(year)"
  } else {
    year <- ""
  }

  form <- paste0(outcome, " ~ ", paste0(outcome, "_lag"), " + ranked_lag + ", 
                 main_controls, additional_controls, year) %>%
    as.formula()

  lm(form, data = df)
}

# Run all the models within the data frame
year_fe_models_all <- year_fe_models_full %>%
  mutate(model = pmap(.l = list(outcome, controls, year_fe, data), 
                      run_year_fe_models),
         # Add robust clustered SEs
         robust_se = pmap(.l = list(model, data, "ccode"), robust_clusterify),
         # Add model summary statistics
         glance = model %>% map(glance),
         # Add a data frame of model parameters with correct SEs
         tidy_robust = robust_se %>% map(~ tidy(.$coef)),
         ses_only = tidy_robust %>% map(~ .$std.error))

# Make tiny data frame indicating if model had country fixed effects
fixed_effects_year <- year_fe_models %>%
  select(controls, year_fe) %>%
  distinct() %>%
  mutate(year_fe = ifelse(year_fe, "Yes", "No")) %>%
  spread(controls, year_fe) %>%
  mutate(Outcome = "Fixed year effects")

# Display all the ranked coefficients
ranked_coefs_year <- year_fe_models_all %>%
  # Spread out the model results
  unnest(tidy_robust) %>%
  filter(str_detect(term, "ranked")) %>%
  # Clean up the estimates and add stars
  mutate(value = paste0(sprintf("%.3f", round(estimate, 3)), p_stars(p.value)),
         outcome = factor(outcome, levels = unique(year_fe_models$outcome),
                          labels = paste0("`", unique(year_fe_models$outcome), "`"),
                          ordered = TRUE),
         controls = factor(controls, levels = unique(year_fe_models$controls),
                           ordered = TRUE)) %>%
  # Get rid of extra columns
  select(Outcome = outcome, controls, value) %>%
  spread(controls, value) %>%
  bind_rows(fixed_effects_year)
Summary of coefficients for the lagged “Ranked” variable with and without country fixed effects
Outcome Main Main + civtot_lag + inttot_lag + loan_ln_lag Main + civtot_lag + inttot_lag + loan_bin_lag Main + fixed effects Main - 2001 Main - 2001 & 2002
sb_proced -0.233*** -0.247*** -0.251*** 0.102 0.102 0.109
sb_days_ln -0.029 -0.027 -0.029 0.053 0.053 0.058
sb_cost_ln -0.074*** -0.078*** -0.079*** 0.033 0.033 0.034
sb_capital_ln -0.003 0.005 0.003 0.320 0.320 0.320
con_proced -1.339*** -1.293*** -1.279*** 0.348 0.348 0.395
con_days -67.590*** -67.839*** -67.357*** -1.605 -1.605 -1.585
Fixed year effects No No No Yes Yes Yes

Note: Main controls are gdpcap_ln_lag, gdpgrowth_lag, polity_lag, and pop_ln_lag

Table E2: Sub-indicators for “Starting a Business” with and without year fixed effects

sb_proced sb_days_ln sb_cost_ln sb_capital_ln
(1) (2) (3) (4) (5) (6) (7) (8)
sb_proced_lag 0.920*** 0.920***
(0.013) (0.015)
sb_days_ln_lag 0.931*** 0.932***
(0.011) (0.012)
sb_cost_ln_lag 0.948*** 0.950***
(0.009) (0.009)
sb_capital_ln_lag 0.924*** 0.926***
(0.009) (0.009)
ranked_lag -0.251*** 0.102 -0.029 0.053 -0.079*** 0.033 0.003 0.320
(0.069) (0.335) (0.019) (0.083) (0.018) (0.052) (0.045) (0.281)
gdpcap_ln_lag -0.017 -0.038* -0.015 -0.014** -0.027** -0.032*** -0.030* -0.017
(0.037) (0.022) (0.009) (0.006) (0.012) (0.009) (0.018) (0.012)
gdpgrowth_lag -0.021*** -0.020*** -0.007*** -0.007*** -0.013*** -0.011*** -0.008 -0.009*
(0.006) (0.006) (0.002) (0.002) (0.002) (0.002) (0.005) (0.005)
polity_lag -0.005 -0.006 -0.002 -0.002* 0.0004 0.0001 0.004 0.004
(0.006) (0.006) (0.001) (0.001) (0.001) (0.001) (0.004) (0.004)
pop_ln_lag 0.041* 0.058** 0.006 0.008* 0.008 0.011** -0.009 -0.003
(0.024) (0.023) (0.006) (0.005) (0.005) (0.005) (0.012) (0.011)
civtot_lag 0.028 0.004 0.004 0.014
(0.026) (0.005) (0.006) (0.014)
inttot_lag 0.076* -0.004 0.031** -0.087
(0.041) (0.016) (0.012) (0.118)
loan_bin_lag 0.103 -0.006 0.036 -0.063
(0.119) (0.029) (0.032) (0.058)
Constant 0.038 -0.095 0.204 0.112 0.213 0.257* 0.432* -0.004
(0.457) (0.426) (0.137) (0.121) (0.159) (0.140) (0.258) (0.238)
Year fixed effects No Yes No Yes No Yes No Yes
Observations 1,659 1,660 1,659 1,660 1,659 1,660 1,558 1,559
R2 0.909 0.910 0.902 0.903 0.963 0.963 0.904 0.906
Adjusted R2 0.909 0.909 0.902 0.902 0.963 0.963 0.903 0.905
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2004 EDB report.

Table E3: Sub-indicators for “Enforcing Contracts” with and without year fixed effects

con_proced con_days
(1) (2) (3) (4)
con_proced_lag 0.708*** 0.780***
(0.023) (0.032)
con_days_lag 0.903*** 0.971***
(0.015) (0.008)
ranked_lag -1.279*** 0.348 -67.357*** -1.605
(0.258) (0.506) (5.427) (3.386)
gdpcap_ln_lag -0.383*** -0.167 -5.263 -3.550**
(0.145) (0.104) (3.237) (1.559)
gdpgrowth_lag -0.038 -0.016 -2.627*** -1.292***
(0.024) (0.025) (0.676) (0.463)
polity_lag -0.112*** -0.083** 1.219** 0.573
(0.039) (0.032) (0.525) (0.376)
pop_ln_lag 0.023 0.124 2.358 3.673**
(0.109) (0.087) (2.561) (1.839)
civtot_lag 0.208** 9.935**
(0.101) (4.295)
inttot_lag 0.292 -2.168
(0.393) (3.915)
loan_bin_lag -0.371 3.842
(0.487) (11.148)
Constant 15.702*** 4.800*** 124.001*** 17.250
(2.421) (1.757) (42.007) (35.766)
Year fixed effects No Yes No Yes
Observations 1,634 1,635 1,633 1,634
R2 0.725 0.836 0.868 0.923
Adjusted R2 0.723 0.834 0.867 0.922
Note: *p<0.1; **p<0.05; ***p<0.01
OLS models. Robust standard errors clustered by country.
Models include countries present in the 2004 EDB report.

Description of Reform Coding

Not generated with this script.

What explains reform committees?

Table F2: Correlates of control variables from Models A1–A5

Correlates of relevant variables with selection into 2001 sample and with outcomes
Model A
in_2001
Model B
sb_days_ln
Model C
sb_proced
Model D
sb_cost_ln
Model E
sb_capital_ln
gdpcap_ln +
gdpgrowth
polity + + +
pop_ln + + +
inttot
civtot
loan_ln

Note: A negative coefficient for the outcome variables indicates improvements.

For models and measures, see section “How control variables relate to being in the sample and to the outcomes” above.

India experiment survey text

Not generated with this script.

Investor experiment survey text

Not generated with this script.

LS0tCnRpdGxlOiAiQXBwZW5kaXggYW5hbHlzaXMiCmF1dGhvcjogIkFuZHJldyBIZWlzcyIKZGF0ZTogIkxhc3QgcnVuOiBgciBmb3JtYXQoU3lzLnRpbWUoKSwgJyVCICVlLCAlWScpYCIKb3V0cHV0OgogIGh0bWxfZG9jdW1lbnQ6CiAgICBjb2RlX2ZvbGRpbmc6IGhpZGUKZWRpdG9yX29wdGlvbnM6CiAgY2h1bmtfb3V0cHV0X3R5cGU6IGNvbnNvbGUKLS0tCgpgYGB7ciBzZXR1cCwgbWVzc2FnZT1GQUxTRX0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGNhY2hlID0gRkFMU0UsIGZpZy5yZXRpbmEgPSAyLAogICAgICAgICAgICAgICAgICAgICAgdGlkeS5vcHRzID0gbGlzdCh3aWR0aC5jdXRvZmYgPSAxMjApLCAgIyBGb3IgY29kZQogICAgICAgICAgICAgICAgICAgICAgd2lkdGggPSAxMjApICAjIEZvciBvdXRwdXQKYGBgCgpgYGB7ciBsb2FkLWxpYnJhcmllcy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2xlYWQgfiBnZHBjYXBfbG4gKyBnZHBncm93dGggKyBwb2xpdHkgKyBwb3BfbG4gKyAKICAgICAgICAgICAgICAgICAgICAgICAgaW50dG90ICsgY2l2dG90ICsgbG9hbl9sbiwgCiAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZWRiX2luXzIwMDEsIGZhbWlseSA9IGJpbm9taWFsKGxpbmsgPSAibG9naXQiKSkgCgptb2RlbF9pbl8yMDAxX3JvYnVzdCA8LSByb2J1c3RfY2x1c3RlcmlmeShtb2RlbF9pbl8yMDAxLCBlZGJfaW5fMjAwMSwgImNjb2RlIikgJT4lCiAgbWFncml0dHI6OnVzZV9zZXJpZXMoY29lZnMpICU+JSB0aWR5KCkKCm1vZGVsX2luXzIwMDFfb3V0IDwtIHN0YXJnYXplcihtb2RlbF9pbl8yMDAxLCB0eXBlID0gImh0bWwiLCBkZXAudmFyLmNhcHRpb24gPSAiIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlcC52YXIubGFiZWxzID0gImluXFxfMjAwMVxcX2xlYWQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2UgPSBsaXN0KG1vZGVsX2luXzIwMDFfcm9idXN0JHN0ZC5lcnJvciksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RlcyA9IGMoIkxvZ2lzdGljIHJlZ3Jlc3Npb24gbW9kZWwuIFJvYnVzdCBzdGFuZGFyZCBlcnJvcnMgY2x1c3RlcmVkIGJ5IGNvdW50cnkuIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1vZGVscyBpbmNsdWRlIGNvdW50cmllcyBwcmVzZW50IGluIHRoZSAyMDAxIEVEQiByZXBvcnQuIikpCmBgYAoKYGBge3IgdGJsLW1vZGVsLWluLTIwMDEsIHJlc3VsdHM9ImFzaXMifQpjYXQocGFzdGUoZXNjYXBlX3N0YXJzKG1vZGVsX2luXzIwMDFfb3V0KSwgY29sbGFwc2UgP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uKgoKCiMgRW5mb3JjaW5nIENvbnRyYWN0cyBpbmRpY2F0b3JzCgoqTm90IGdlbmVyYXRlZCB3aXRoIHRoaXMgc2NyaXB0LioKCgojIFBvbGljeSByZWZvcm06IE9MUyBtb2RlbHMKCmBgYHtyIG1vZGVscy1vbHMtYWxsfQojIERlZmluZSBhbGwgdGhlIG1vZGVscyB0aGF0IG5lZWQgdG8gYmUgcnVuCm1vZGVsc190b19ydW4gPC0gZXhwYW5kLmdyaWQoeWVhciA9IDIwMDM6MjAxMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRjb21lID0gYygic2JfcHJvY2VkIiwgInNiX2RheXNfbG4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzYl9jb3N0X2xuIiwgInNiX2NhcGl0YWxfbG4iKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncm91cGluZyA9IGMoIkFsbCBjb3VudHJpZXMiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk5vIEVEQiByZWZvcm0gY29tbWl0dGVlIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTcGVjaWFsIEVEQiByZWZvcm0gY29tbWl0dGVlIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nc0FzRmFjdG9ycyA9IEZBTFNFKQoKIyBBcyBpbiB0aGUgcGFwZXIgYW5hbHlzaXMsIHRoaXMgZnVuY3Rpb24gZ2VuZXJhdGVzIGFuIFIgbW9kZWwgZm9ybXVsYSBiYXNlZCBvbgojIHRoZSBuYW1lIG9mIHRoZSBkZXBlbmRlbnQgdmFyaWFibGUgYW5kIHRoZSB5ZWFyIHByb3ZpZGVkLiBpLmUuLCBnaXZlbgojICJzYl9wcm9jZWQiIGFuZCAiMjAwNSIsIGl0IHdpbGwgY3JlYXRlIHRoZSBmb3JtdWxhICJzYl9wcm9jZWQgfiBzYl9wcm9jZWRfbGF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gPSBjKCJuIiwgInJzcSIsICJhZGoucnNxIikpCgp0YmxfaXRzXzIwMDYgPC0gaXRzX21vZGVsc19sYWdnZWQgJT4lCiAgZmlsdGVyKGdyb3VwaW5nID09ICJBbGwgY291bnRyaWVzIiwgeWVhciA9PSAyMDA2KQoKdGJsX2l0c18yMDA2X291dCA8LSBzdGFyZ2F6ZXIodGJsX2l0c18yMDA2JG1vZGVsLCB0eXBlID0gImh0bWwiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlID0gdGJsX2l0c18yMDA2JHNlc19vbmx5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RlcyA9IGMoIklUUyBtb2RlbHMuIFJvYnVzdCBzdGFuZGFyZCBlcnJvcnMgY2x1c3RlcmVkIGJ5IGNvdW50cnkuIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTW9kZWxzIGluY2x1ZGUgY291bnRyaWVzIHByZXNlbnQgaW4gdGhlIDIwMDEgRURCIHJlcG9ydC4iKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2VlcC5zdGF0ID0gYygibiIsICJyc3EiLCAiYWRqLnJzcSIpKQpgYGAKCmBgYHtyIHRibC1pdHMtMjAwNSwgcmVzdWx0cz0iYXNpcyJ9CmNhdChwYXN0ZShlc2NhcGVfc3RhcnModGJsX2l0c18yMDA1X291dCksIGNvbGxhcHNlID0gIlxuIiksICJcbiIpCmNhdChwYXN0ZSh0YmxfaXRzXzIwMDVfb3V0LCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iLAogICAgZmlsZSA9IGZpbGUucGF0aChoZXJlKCksICJvdXRwdXQiLCAidGFibGVzIiwgImFwcF9tb2RlbHNfQzEuaHRtbCIpKQpgYGAKCiMjIFRhYmxlIEMyOiAyMDA2IGFuYWx5c2lzLCBmdWxsIElUUyBtb2RlbHM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IgcmFua2VkLWNvdW50cnktZmUsIHdhcm5pbmc9RkFMU0V9CiMgQWxsIHRoZSBGRSBtb2RlbHMgdG8gYmUgcnVuCmNvdW50cnlfZmVfbW9kZWxzIDwtIGV4cGFuZC5ncmlkKG91dGNvbWUgPSBjKCJzYl9wcm9jZWQiLCAic2JfZGF5c19sbiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzYl9jb3N0X2xuIiwgInNiX2NhcGl0YWxfbG4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY29uX3Byb2NlZCIsICJjb25fZGF5cyIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250cm9scyA9IGMoIk1haW4iLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNYWluICsgYGNpdnRvdF9sYWdgICsgYGludHRvdF9sYWdgICsgYGxvYW5fbG5fbGFnYCIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1haW4gKyBgY2l2dG90X2xhZ2AgKyBgaW50dG90X2xhZ2AgKyBgbG9hbl9iaW5fbGFnYCIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1haW4gKyBmaXhlZCBlZmZlY3RzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNYWluIC0gMjAwMSIsICJNYWluIC0gMjAwMSAmIDIwMDIiKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nc0FzRmFjdG9ycyA9IEZBTFNFKSAlPiUKICBtdXRhdGUoY291bnRyeV9mZSA9IGNvbnRyb2xzICVpbiUgYygiTWFpbiArIGZpeGVkIGVmZmVjdHMiLCAiTWFpbiAtIDIwMDEiLCAiTWFpbiAtIDIwMDEgJiAyMDAyIiksCiAgICAgICAgIGRmX3RvX3VzZSA9IGNh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YXJnYXplcihzYl9mZSRtb2RlbCwgdHlwZSA9ICJodG1sIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2UgPSBzYl9mZSRzZXNfb25seSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RlcyA9IGMoIk9MUyBtb2RlbHMuIFJvYnVzdCBzdGFuZGFyZCBlcnJvcnMgY2x1c3RlcmVkIGJ5IGNvdW50cnkuIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1vZGVscyBpbmNsdWRlIGNvdW50cmllcyBwcmVzZW50IGluIHRoZSAyMDA0IEVEQiByZXBvcnQuIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2VlcC5zdGF0ID0gYygibiIsICJyc3EiLCAiYWRqLnJzcSIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZC5saW5lcyA9IGxpc3QoYygiQ291bnRyeSBmaXhlZCBlZmZlY3RzIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcChjKCJObyIsICJZZXMiKSwgNCkpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbWl0ID0gImNjb2RlIikKYGBgCgpgYGB7ciB0Ymwtc2ItY291bnRyeS1mZSwgcmVzdWx0cz0iYXNpcyJ9CmNhdChwYXN0ZShlc2NhcGVfc3RhcnMoc2JfY291bnRyeV9mZV9tb2RlbHNfb3V0KSwgY29sbGFwc2UgPSAiXG4iKSwgIlxuIikKY2F0KHBhc3RlKHNiX2NvdW50cnlfZmVfbW9kZWxzX291dCwgY29sbGFwc2UgPSAiXG4iKSwgIlxuIiwKICAgIGZpbGUgPSBmaWxlLnBhdGgoaGVyZSgpLCAib3V0cHV0IiwgInRhYmxlcyIsICJhcHBfdGFibGVfRDIuaHRtbCIpKQpgYGAKCiMjIFRhYmxlIEQzOiBTdWItaW5kaWNhdG9ycyBmb3IgIkVuZm9yY2luZyBDb250cmFjdHMiIHdpdGggYW5kIHdpdGhvdXQgY291bnRyeSBmaXhlZCBlZmZlY3RzCgpgYGB7ciBjb24tY291bnRyeS1mZSwgcmVzdWx0cz0iaGlkZSJ9CmNvbl9mZSA8LSBjb3VudHJ5X2ZlX21vZGVsc19hbGwgJT4lCiAgZmlsdGVyKHN0cl9kZXRlY3Qob3V0Y29tZSwgImNvbl8iKSwKICAgICAgICAgY29udHJvbHMgJWluJSBjKCJNYWluICsgZml4ZWQgZWZmZWN0cyIsIAogICAgICAgICAgICAgICAgICAgICAgICAgIk1haW4gKyBgY2l2dG90X2xhZ2AgKyBgaW50dG90X2xhZ2AgKyBgbG9hbl9iaW5fbGFnYCIpKSAlPiUKICBtdXRhdGUob3V0Y29tZSA9IGZjdF9pbm9yZGVyKG91dGNvbWUsIG9yZGVyZWQgPSBUUlVFKSkgJT4lCiAgYXJyYW5nZShvdXRjb21lKQoKY29uX2NvdW50cnlfZmVfbW9kZWxzX291dCA8LSBzdGFyZ2F6ZXIoY29uX2ZlJG1vZGVsLCB0eXBlID0gImh0bWwiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlID0gY29uX2ZlJHNlc19vbmx5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RlcyA9IGMoIk9MUyBtb2RlbHMuIFJvYnVzdCBzdGFuZGFyZCBlcnJvcnMgY2x1c3RlcmVkIGJ5IGNvdW50cnkuIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNb2RlbHMgaW5jbHVkZSBjb3VudHJpZXMgcHJlc2VudCBpbiB0aGUgMjAwNCBFREIgcmVwb3J0LiIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwLnN0YXQgPSBjKCJuIiwgInJzcSIsICJhZGoucnNxIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZC5saW5lcyA9IGxpc3QoYygiQ291bnRyeSBmaXhlZCBlZmZlY3RzIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXAoYygiTm8iLCAiWWVzIiksIDQpKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9taXQgPSAiY2NvZGUiKQpgYGAKCmBgYHtyIHRibC1jb24tY291bnRyeS1mZSwgcmVzdWx0cz0iYXNpcyJ9CmNhdChwYXN0ZShlc2NhcGVfc3RhcnMoY29uX2NvdW50cnlfZmVfbW9kZWxzX291dCksIGNvbGxhcHNlID0gIlxuIiksICJcbiIpCmNhdChwYXN0ZShjb25fY291bnRyeV9mZV9tb2RlbHNfb3V0LCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iLAogICAgZmlsZSA9IGZpbGUucGF0aChoZXJlKCksICJvdXRwdXQiLCAidGFibGVzIiwgImFwcF90YWJsZV9EMy5odG1sIikpCmBgYAoKCiMgWWVhciBmaXhlZCBlZmZlY3RzIGZvciBPTFMgbW9kZWxzCgojIyBUYWJsZSBFMTogIlJhbmtlZCIgY29lZmZpY2llbnRzIHdpdGggYW5kIHdpdGhvdXQgeWVhciBmaXhlZCBlZmZlY3RzCgpgYGB7ciByYW5rZWQteWVhci1mZSwgd2FybmluZz1GQUxTRX0KIyBBbGwgdGhlIEZFIG1vZGVscyB0byBiZSBydW4KeWVhcl9mZV9tb2RlbHMgPC0gZXhwYW5kLmdyaWQob3V0Y29tZSA9IGMoInNiX3Byb2NlZCIsICJzYl9kYXlzX2xuIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNiX2Nvc3RfbG4iLCAic2JfY2FwaXRhbF9sbiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjb25fcHJvY2VkIiwgImNvbl9kYXlzIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRyb2xzID0gYygiTWFpbiIsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1haW4gKyBgY2l2dG90X2xhZ2AgKyBgaW50dG90X2xhZ2AgKyBgbG9hbl9sbl9sYWdgIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWFpbiArIGBjaXZ0b3RfbGFnYCArIGBpbnR0b3RfbGFnYCArIGBsb2FuX2Jpbl9sYWdgIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWFpbiArIGZpeGVkIGVmZmVjdHMiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1haW4gLSAyMDAxIiwgIk1haW4gLSAyMDAxICYgMjAwMiIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmdzQXNGYWN0b3JzID0gRkFMU0UpICU+JQogIG11dGF0ZSh5ZWFyX2ZlID0gY29udHJvbHMgJWluJSBjKCJNYWluICsgZml4ZWQgZWZmZWN0cyIsICJNYWluIC0gMjAwMSIsICJNYWluIC0gMjAwMSAmIDIwMDIiKSwKICAgICAgICAgZGZfdG9fdXNlID0gY2FzZV93aGVuKAogICAgICAgICAgIGNvbnRyb2xzID09ICJNYWluIC0gMjAwMSIgfiAiRHJvcCAyMDAxIiwKICAgICAgICAgICBjb250cm9scyA9PSAiTWFpbiAtIDIwMDEgJiAyMDAyIiB+ICJEcm9wIDIwMDIiLAogICAgICAgICAgIFRSVUUgfiAiRnVsbCIgCiAgICAgICAgICkpCgojIE5lc3QgZmlsdGVyZWQgZGF0YSBpbnRvIG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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1vZGVscyBpbmNsdWRlIGNvdW50cmllcyBwcmVzZW50IGluIHRoZSAyMDA0IEVEQiByZXBvcnQuIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2VlcC5zdGF0ID0gYygibiIsICJyc3EiLCAiYWRqLnJzcSIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZC5saW5lcyA9IGxpc3QoYygiWWVhciBmaXhlZCBlZmZlY3RzIiwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcChjKCJObyIsICJZZXMiKSwgNCkpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbWl0ID0gInllYXIiKQpgYGAKCmBgYHtyIHRibC1zYi15ZWFyLWZlLCByZXN1bHRzPSJhc2lzIn0KY2F0KHBhc3RlKGVzY2FwZV9zdGFycyhzYl95ZWFyX2ZlX21vZGVsc19vdXQpLCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iKQpjYXQocGFzdGUoc2JfeWVhcl9mZV9tb2RlbHNfb3V0LCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iLAogICAgZmlsZSA9IGZpbGUucGF0aChoZXJlKCksICJvdXRwdXQiLCAidGFibGVzIiwgImFwcF90YWJsZV9FMi5odG1sIikpCmBgYAoKIyMgVGFibGUgRTM6IFN1Yi1pbmRpY2F0b3JzIGZvciAiRW5mb3JjaW5nIENvbnRyYWN0cyIgd2l0aCBhbmQgd2l0aG91dCB5ZWFyIGZpeGVkIGVmZmVjdHMKCmBgYHtyIGNvbi15ZWFyLWZlLCByZXN1bHRzPSJoaWRlIn0KY29uX2ZlX3llYXIgPC0geWVhcl9mZV9tb2RlbHNfYWxsICU+JQogIGZpbHRlcihzdHJfZGV0ZWN0KG91dGNvbWUsICJjb25fIiksCiAgICAgICAgIGNvbnRyb2xzICVpbiUgYygiTWFpbiArIGZpeGVkIGVmZmVjdHMiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICJNYWluICsgYGNpdnRvdF9sYWdgICsgYGludHRvdF9sYWdgICsgYGxvYW5fYmluX2xhZ2AiKSkgJT4lCiAgbXV0YXRlKG91dGNvbWUgPSBmY3RfaW5vcmRlcihvdXRjb21lLCBvcmRlcmVkID0gVFJVRSkpICU+JQogIGFycmFuZ2Uob3V0Y29tZSkKCmNvbl95ZWFyX2ZlX21vZGVsc19vdXQgPC0gc3RhcmdhemVyKGNvbl9mZV95ZWFyJG1vZGVsLCB0eXBlID0gImh0bWwiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLnZhci5jYXB0aW9uID0gIiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlID0gY29uX2ZlX3llYXIkc2VzX29ubHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vdGVzID0gYygiT0xTIG1vZGVscy4gUm9idXN0IHN0YW5kYXJkIGVycm9ycyBjbHVzdGVyZWQgYnkgY291bnRyeS4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1vZGVscyBpbmNsdWRlIGNvdW50cmllcyBwcmVzZW50IGluIHRoZSAyMDA0IEVEQiByZXBvcnQuIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXAuc3RhdCA9IGMoIm4iLCAicnNxIiwgImFkai5yc3EiKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkLmxpbmVzID0gbGlzdChjKCJZZWFyIGZpeGVkIGVmZmVjdHMiLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcChjKCJObyIsICJZZXMiKSwgNCkpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb21pdCA9ICJ5ZWFyIikKYGB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Cm1vZGVsX3JhbmtpbmdzIDwtIGxtKGAyMDE0YCB+IGAyMDA1YCArIGhhc19idXJlYXUsCiAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBlZGJfcmFua2luZ3MpCgptb2RlbF9yYW5raW5nc19pbnRlcmFjdGlvbiA8LSBsbShgMjAxNGAgfiBgMjAwNWAgKyBoYXNfYnVyZWF1ICsgYDIwMDVgICogaGFzX2J1cmVhdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGVkYl9yYW5raW5ncykKCm1vZGVsX3JhbmtpbmdzX2NoYW5nZSA8LSBsbShjaGFuZ2VfaW5fcmFua2luZyB+IGhhc19idXJlYXUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZWRiX3JhbmtpbmdzKQoKdmFyX2xhYnMgPC0gYygiMjAwNSByYW5raW5nIiwgIkhhcyByZWZvcm0gY29tbWl0dGVlIiwKICAgICAgICAgICAgICAiMjAwNSByYW5raW5nIMOXIGhhcyByZWZvcm0gY29tbWl0dGVlIikKCm1vZGVsX3JhbmtpbmdzX291dCA8LSBzdGFyZ2F6ZXIobW9kZWxfcmFua2luZ3MsIG1vZGVsX3JhbmtpbmdzX2ludGVyYWN0aW9uLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlbF9yYW5raW5nc19jaGFuZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9ICJodG1sIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXAudmFyLmNhcHRpb24gPSAiIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXAudmFyLmxhYmVscyA9IGMoIjIwMTQiLCAiQ2hhbmdlIGluIHJhbmtpbmciKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3ZhcmlhdGUubGFiZWxzID0gdmFyX2xhYnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90ZXMgPSAiT0xTIG1vZGVscy4gTm9uLXJvYnVzdCBzdGFuZGFyZCBlcnJvcnMuIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwLnN0YXQgPSBjKCJuIiwgInJzcSIsICJhZGoucnNxIikpCmBgYAoKYGBge3IgdGJsLXJlZm9ybS1jb21taXR0ZWUtMjAwNS0yMDE0LCByZXN1bHRzPSJhc2lzIn0KY2F0KHBhc3RlKGVzY2FwZV9zdGFycyhtb2RlbF9yYW5raW5nc19vdXQpLCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iKQpjYXQocGFzdGUobW9kZWxfcmFua2luZ3Nfb3V0LCBjb2xsYXBzZSA9ICJcbiIpLCAiXG4iLAogICAgZmlsZSA9IGZpbGUucGF0aChoZXJlKCksICJvdXRwdXQiLCAidGFibGVzIiwgImFwcF90YWJsZV9GMy5odG1sIikpCmBgYAoKCiMgSW5kaWEgZXhwZXJpbWVudCBzdXJ2ZXkgdGV4dAoKKk5vdCBnZW5lcmF0ZWQgd2l0aCB0aGlzIHNjcmlwdC4qCgoKIyBJbnZlc3RvciBleHBlcmltZW50IHN1cnZleSB0ZXh0CgoqTm90IGdlbmVyYXRlZCB3aXRoIHRoaXMgc2NyaXB0LioK