Chapter 11 Regression Discontinuity Designs (RDD)

11.1 Libraries

library(dplyr)        # data manipulation
library(tibble)       # cuter dataframes
library(haven)        # read dta files
library(rddensity)    # density tests
library(rdrobust)     # rdd estimation
library(ggplot2)      # plot graphs
library(stargazer)    # nice tables
library(stringr)      # to combine strings

11.2 What is the paper about?

Well, let’s look at the abstract:

“Does Islamic political control affect women’s empowerment? Several countries have recently experienced Islamic parties coming to power through democratic elections. Due to strong support among religious conservatives, constituencies with Islamic rule often tend to exhibit poor women’s rights. Whether this reflects a causal relationship or a spurious one has so far gone unexplored. I provide the first piece of evidence using a new and unique data set of Turkish municipalities. In 1994, an Islamic party won multiple municipal mayor seats across the country. Using a regression discontinuity (RD) design, I compare municipalities where this Islamic party barely won or lost elections. Despite negative raw correlations, the RD results reveal that, over a period of six years, Islamic rule increased female secular high school education. Corresponding effects for men are systematically smaller and less precise. In the longer run, the effect on female education remained persistent up to 17 years after, and also reduced adolescent marriages. An analysis of long-run political effects of Islamic rule shows increased female political participation and an overall decrease in Islamic political preferences. The results are consistent with an explanation that emphasizes the Islamic party’s effectiveness in overcoming barriers to female entry for the poor and pious.”

11.3 Let’s load the data.

empowerment = read_dta("data/meyersson/regdata0.dta")

11.4 Select and rename variables

empowerment = empowerment %>% 
  select(vote_share_islam_1994 = vshr_islam1994,
         islamic_mayor_1994 = i94,
         log_pop_1994 = lpop1994,
         no_of_parties_1994 = partycount,
         share_women_hs_1520 = hischshr1520f,
         share_men_hs_1520 = hischshr1520m,
         pop_share_under_19 = ageshr19,
         pop_share_over_60 = ageshr60,
         sex_ratio_2000 = sexr,
         win_margin_islam_1994 = iwm94,
         household_size_2000 = shhs,
         district_center = merkezi, 
         province_center = merkezp,
         metro_center = buyuk,
         sub_metro_center = subbuyuk,
         pd_1:pd_67, 
         pcode = pcode)

11.5 Create Sample

empowerment = empowerment %>% 
  filter(!is.na(share_women_hs_1520),
         !is.na(vote_share_islam_1994),
         !is.na(no_of_parties_1994),
         !is.na(win_margin_islam_1994),
         !is.na(islamic_mayor_1994),
         !is.na(share_men_hs_1520),
         !is.na(household_size_2000),
         !is.na(log_pop_1994),
         !is.na(pop_share_under_19),
         !is.na(pop_share_over_60),
         !is.na(sex_ratio_2000),
         !is.na(district_center),
         !is.na(province_center),
         !is.na(metro_center),
         !is.na(sub_metro_center))

11.6 Create Vector of Control Variables

Z = empowerment %>% 
  select(vote_share_islam_1994,
         no_of_parties_1994,
         household_size_2000,
         log_pop_1994,
         pop_share_under_19,
         pop_share_over_60,
         sex_ratio_2000,
         district_center,
         province_center,
         sub_metro_center,
         metro_center)

11.7 Summary Statistics

11.8 Histogram of Islamic Win Margin

We first need to create a dataframe for which our outcome and explanatory variables are available. This is at least what Meyersson does. It is not so clear whether this is the best way of doing it.

ggplot(empowerment) + 
  geom_histogram(aes(x = win_margin_islam_1994,
                     y = ..count../sum(..count..)*100),
                 binwidth = 0.02, color = "grey") +
  labs(x = "Islamic Win Margin in 1994",
       y = "Percent",
       title = "Histogram of Islamic Win Margin") +
  theme_bw()

out = rddensity(empowerment$win_margin_islam_1994)
summary(out)
## 
## Manipulation testing using local polynomial density estimation.
## 
## Number of obs =       2629
## Model =               unrestricted
## Kernel =              triangular
## BW method =           estimated
## VCE method =          jackknife
## 
## c = 0                 Left of c           Right of c          
## Number of obs         2314                315                 
## Eff. Number of obs    965                 301                 
## Order est. (p)        2                   2                   
## Order bias (q)        3                   3                   
## BW est. (h)           0.305               0.283               
## 
## Method                T                   P > |T|             
## Robust                -1.3937             0.1634              
## 
## 
## P-values of binomial tests (H0: p=0.5).
## 
## Window Length / 2          <c     >=c    P>|T|
## 0.004                      11       9    0.8238
## 0.009                      18      26    0.2912
## 0.013                      32      34    0.9022
## 0.017                      42      48    0.5984
## 0.021                      52      57    0.7018
## 0.026                      68      62    0.6612
## 0.030                      74      71    0.8682
## 0.034                      94      79    0.2871
## 0.038                     113      86    0.0650
## 0.043                     131      90    0.0070

11.9 Doing RDD by Hand

empower_left = empowerment %>% 
  filter(win_margin_islam_1994 < 0,
         win_margin_islam_1994 >= -.24)
empower_right = empowerment %>% 
  filter(win_margin_islam_1994 > 0,
         win_margin_islam_1994 <= .24)

lm_left = lm(share_women_hs_1520 ~ win_margin_islam_1994, empower_left)
lm_right = lm(share_women_hs_1520 ~ win_margin_islam_1994, empower_right)

intercept_left = lm_left$coefficients[1]
intercept_right = lm_right$coefficients[1]
difference = intercept_right - intercept_left

print(str_c("The RD estimator is ", difference, "."))
## [1] "The RD estimator is 0.0317363445877732."

11.10 rdrobust Package

11.10.1 RDD with and without controls

# rdd with and without controls: women
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.240, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             728          293
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.240        0.240
## BW bias (b)                   0.240        0.240
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.030     0.015     1.979     0.048     [0.000 , 0.059]     
##         Robust         -         -     1.411     0.158    [-0.011 , 0.066]     
## =============================================================================
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.240, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             728          293
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.240        0.240
## BW bias (b)                   0.240        0.240
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.025     0.009     2.894     0.004     [0.008 , 0.043]     
##         Robust         -         -     2.607     0.009     [0.008 , 0.053]     
## =============================================================================
# rdd with and without controls: men
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.323, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            1038          304
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.323        0.323
## BW bias (b)                   0.323        0.323
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.012     0.010     1.159     0.247    [-0.008 , 0.031]     
##         Robust         -         -     1.607     0.108    [-0.004 , 0.045]     
## =============================================================================
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.323, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            1038          304
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.323        0.323
## BW bias (b)                   0.323        0.323
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.009     0.009     1.026     0.305    [-0.008 , 0.026]     
##         Robust         -         -     1.621     0.105    [-0.004 , 0.042]     
## =============================================================================

11.10.2 Different bandwidths

# different bandwiths: women
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.120, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             369          220
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.120        0.120
## BW bias (b)                   0.120        0.120
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.030     0.011     2.757     0.006     [0.009 , 0.052]     
##         Robust         -         -     2.262     0.024     [0.005 , 0.064]     
## =============================================================================
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.480, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            1742          310
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.480        0.480
## BW bias (b)                   0.480        0.480
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.022     0.008     2.883     0.004     [0.007 , 0.036]     
##         Robust         -         -     2.677     0.007     [0.007 , 0.045]     
## =============================================================================
# different bandwidths: men
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.161, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             493          254
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.161        0.161
## BW bias (b)                   0.161        0.161
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.018     0.011     1.686     0.092    [-0.003 , 0.040]     
##         Robust         -         -     1.238     0.216    [-0.011 , 0.048]     
## =============================================================================
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.646, covs = Z, cluster = empowerment$pcode))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            2270          314
## Order est. (p)                    1            1
## Order bias  (q)                   2            2
## BW est. (h)                   0.646        0.646
## BW bias (b)                   0.646        0.646
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.008     0.008     1.061     0.289    [-0.007 , 0.024]     
##         Robust         -         -     1.011     0.312    [-0.009 , 0.029]     
## =============================================================================

11.10.3 Different control functions

# different control functions: women
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.240, covs = Z, cluster = empowerment$pcode, p = 2))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             728          293
## Order est. (p)                    2            2
## Order bias  (q)                   3            3
## BW est. (h)                   0.240        0.240
## BW bias (b)                   0.240        0.240
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.030     0.012     2.608     0.009     [0.008 , 0.053]     
##         Robust         -         -     2.569     0.010     [0.009 , 0.064]     
## =============================================================================
summary(rdrobust(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994, h = 0.240, covs = Z, cluster = empowerment$pcode, p = 3))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.             728          293
## Order est. (p)                    3            3
## Order bias  (q)                   4            4
## BW est. (h)                   0.240        0.240
## BW bias (b)                   0.240        0.240
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.037     0.014     2.570     0.010     [0.009 , 0.065]     
##         Robust         -         -     1.889     0.059    [-0.001 , 0.070]     
## =============================================================================
# different control functions: men
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.323, covs = Z, cluster = empowerment$pcode, p = 2))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            1038          304
## Order est. (p)                    2            2
## Order bias  (q)                   3            3
## BW est. (h)                   0.323        0.323
## BW bias (b)                   0.323        0.323
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.019     0.012     1.626     0.104    [-0.004 , 0.042]     
##         Robust         -         -     1.557     0.120    [-0.006 , 0.052]     
## =============================================================================
summary(rdrobust(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994, h = 0.323, covs = Z, cluster = empowerment$pcode, p = 3))
## Call: rdrobust
## 
## Number of Obs.                 2629
## BW type                      Manual
## Kernel                   Triangular
## VCE method                       NN
## 
## Number of Obs.                 2314          315
## Eff. Number of Obs.            1038          304
## Order est. (p)                    3            3
## Order bias  (q)                   4            4
## BW est. (h)                   0.323        0.323
## BW bias (b)                   0.323        0.323
## rho (h/b)                     1.000        1.000
## Unique Obs.                    2312          315
## 
## =============================================================================
##         Method     Coef. Std. Err.         z     P>|z|      [ 95% C.I. ]       
## =============================================================================
##   Conventional     0.023     0.015     1.557     0.120    [-0.006 , 0.052]     
##         Robust         -         -     1.268     0.205    [-0.012 , 0.055]     
## =============================================================================

11.11 RDD Plots

11.11.1 Main Outcomes: Women

rdplot(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Women in Highschool (15-20)",
       y.lim = c(0, .5))

rdplot(empowerment$share_women_hs_1520, empowerment$win_margin_islam_1994,
       h = 0.240,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Women in Highschool (15-20)",
       y.lim = c(0, .5))

empower_plot = empowerment %>% 
  filter(win_margin_islam_1994 >= -0.240,
         win_margin_islam_1994 <=  0.240)

rdplot(empower_plot$share_women_hs_1520, empower_plot$win_margin_islam_1994,
       h = 0.240,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Women in Highschool (15-20)",
       y.lim = c(0, .25))

11.11.2 Main Outcomes: Men

rdplot(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Men in Highschool (15-20)",
       y.lim = c(0, .5))

rdplot(empowerment$share_men_hs_1520, empowerment$win_margin_islam_1994,
       h = 0.240,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Men in Highschool (15-20)",
       y.lim = c(0, .5))

rdplot(empower_plot$share_men_hs_1520, empower_plot$win_margin_islam_1994,
       h = 0.240,
       x.label = "Running Variable: Islamic Vote Share",
       y.label = "Share of Men in Highschool (15-20)",
       y.lim = c(0, .25))