rdrobust: An R Package for Robust Nonparametric Inference in Regression-Discontinuity Designs

This article describes the R package rdrobust, which provides data-driven graphical and inference procedures for RD designs. The package includes three main functions: rdrobust, rdbwselect and rdplot. The first function (rdrobust) implements conventional local-polynomial RD treatment effect point estimators and confidence intervals, as well as robust bias-corrected confidence intervals, for average treatment effects at the cutoff. This function covers sharp RD, sharp kink RD, fuzzy RD and fuzzy kink RD designs, among other possibilities. The second function (rdbwselect) implements several bandwidth selectors proposed in the RD literature. The third function (rdplot) provides data-driven optimal choices of evenly-spaced and quantile-spaced partition sizes, which are used to implement several data-driven RD plots.

Sebastian Calonico (Department of Economics, University of Miami) , Matias D. Cattaneo (Department of Economics, University of Michigan) , Rocío Titiunik (Department of Political Science, University of Michigan)
2015-04-23

1 Introduction

The regression-discontinuity (RD) design is a widely employed quasi-experimental research design in social, behavioral and related sciences; for reviews see Imbens and T. Lemieux (2008) and Lee and T. Lemieux (2010). In this design, units are assigned to treatment based on whether their value of an observed covariate is above or below a known cutoff, and the probability of receiving treatment conditional on this covariate jumps discontinuously at the cutoff. This jump induces “variation” in treatment assignment that may be regarded, under appropriate assumptions, as being unrelated to potential confounders. Thus, inference in RD designs is typically conducted using only observations near the cutoff or threshold, where the discontinuous change in the probability of treatment assignment occurs. Due to its local nature, RD average treatment effects estimators are usually constructed using local-polynomial nonparametric regression, and statistical inference is based on large-sample approximations.

This article gives an introduction to the R package rdrobust (Calonico et al. 2015b), which offers an array of data-driven local-polynomial and partitioning-based inference procedures for RD designs. We introduce three main functions implementing several data-driven nonparametric point and confidence intervals estimators, bandwidth selectors, and plotting procedures useful for RD empirical applications:

We first provide a brief review of all the methods implemented in rdrobust, and then discuss an empirical illustration using some of the features of our functions rdrobust(), rdbwselect() and rdplot(). A full description of the capabilities of the package rdrobust is available in its manual and help files. A companion Stata (StataCorp. 2013) package is described in Calonico, M. D. Cattaneo, and R. Titiunik (2014).

2 Review of methods

We now present the basic RD framework, describe the population parameters of interest, introduce the local-polynomial based estimators, review different inference procedures, and briefly summarize the popular RD plots. Regularity conditions and other technical aspects underlying the estimands and estimators may be found in the references given throughout. Recent results and further details on RD designs are discussed in IK and CCT (see also the supplemental appendix), and references therein.

Setup and notation

We adopt the potential outcomes framework commonly employed in the treatment effects literature (e.g., Heckman and E. J. Vytlacil (2007) and Imbens and J. M. Wooldridge (2009)). Let \(\{(Y_i(0),Y_i(1),T_i(0),T_i(1),\) \(X_i)' : i=1,2,\ldots,n\}\) be a random sample from \((Y(0),Y(1),T(0),T(1),X)'\), where \(Y(1)\) and \(Y(0)\) denote the potential outcomes with and without treatment, respectively, \(T(0)\) and \(T(1)\) denote potential treatment status, and the scalar regressor \(X_i\in\mathbb{R}\) is the so-called “running variable” or “score” determining treatment assignment based on whether it exceeds a known cutoff. In particular, unit \(i\) is assigned treatment if \(X_i>\bar{x}\) and not assigned treatment if \(X_i<\bar{x}\), for some known fixed value \(\bar{x}\in\mathbb{R}\). \(f(x)\) denotes the continuous (Lebesgue) density of \(X_i\).

This setup allows for imperfect compliance, which in the RD literature is known as the fuzzy RD design. The case of perfect treatment compliance is usually called the sharp RD design. In either case, the observed outcome and treatment status are, respectively, \[Y_i =\left\{ \begin{array}{ccl} Y_i(0) && \text{if } X_i<\bar{x} \\ Y_i(1) && \text{if } X_i\ge\bar{x}\\ \end{array} \right.\qquad \text{and} \qquad T_i =\left\{ \begin{array}{ccl} T_i(0) && \text{if } X_i<\bar{x}\\ T_i(1) && \text{if } X_i\ge\bar{x}\\ \end{array} \right..\]

The observed data is \(\{(Y_i,T_i,X_i)' : i=1,2,\ldots,n\}\), a random sample from a large population. In sharp RD designs, \(T_i=\mathbb{1}(X_i\ge\bar{x})\) with \(\mathbb{1}(\cdot)\) denoting the indicator function, which leads to \(\mathbb{P}[T_i=0|X_i<\bar{x}]=1=\mathbb{P}[T_i=1|X_i\ge\bar{x}]\). More generally, in fuzzy RD designs, treatment assignment and treatment status may differ (imperfect compliance). Therefore, for each unit \(i\), the scalar random variable \(Y_i\in\mathbb{R}\) denotes the outcome of interest, and \(T_i\in\{0,1\}\) denotes actual treatment take-up (\(T_i=1\) treatment taken, \(T_i=0\) treatment not taken).

We introduce some additional notation. For \(\nu\in\mathbb{Z}_+=\{0,1,2,\ldots\}\), define \[\mu_{Y+}^{(\nu)}(\bar{x})=\lim_{x\to\bar{x}^+}\frac{\partial^\nu}{\partial x^\nu} \mu_{Y+}(x),\qquad \mu_{Y-}^{(\nu)}(\bar{x})=\lim_{x\to\bar{x}^-}\frac{\partial^\nu}{\partial x^\nu} \mu_{Y-}(x),\] with \(\mu_{Y+}(x)=\mathbb{E}[Y(1)|X=x]\) and \(\mu_{Y-}(x)=\mathbb{E}[Y(0)|X=x]\), and \[\mu_{T+}^{(\nu)}(\bar{x})=\lim_{x\to\bar{x}^+}\frac{\partial^\nu}{\partial x^\nu} \mu_{T+}(x),\qquad \mu_{T-}^{(\nu)}(\bar{x})=\lim_{x\to\bar{x}^-}\frac{\partial^\nu}{\partial x^\nu} \mu_{T-}(x),\] with \(\mu_{T+}(x)=\mathbb{E}[T(1)|X=x]\) and \(\mu_{T-}(x)=\mathbb{E}[T(0)|X=x]\). Whenever there is no ambiguity, we drop the subindex denoting the dependent variable or the point of evaluation in the conditional expectations and other functions.

Population parameters of interest

We focus on average treatment effects at the cutoff in the sharp RD, fuzzy RD, sharp kink RD and fuzzy kink RD designs, although the results cover other possibilities. For further details on the interpretation of these estimands and regularity conditions see, among others, (Hahn, P. Todd, and W. van der Klaauw 2001), Porter (2003), Lee (2008), IK, CCT, (Card et al. 2014), and references therein.

Local polynomial estimators

Statistical inference in the RD design reduces to nonparametric regression inference at the induced boundary point \(\bar{x}\), employing observations at either side of the threshold separately. Local-polynomial estimators have become the preferred choice of nonparametric estimator in the RD literature because of their excellent boundary properties (Fan and Gijbels 1996). The package rdrobust implements local polynomial estimators of various orders for the two variables \(Y_i\) and \(T_i\) depending on the RD design considered, and also includes different bandwidths selectors and alternative confidence intervals estimators. All these features are briefly reviewed in the following subsections, but first we introduce the local polynomial RD estimators of order \(p\) in general. To reduce repetition, we describe the estimators using a generic outcome variable \(Z\) which either takes the value \(Y\) or \(T\), depending on the outcome variable under consideration. For \(Z\in\{Y,T\}\) and \(\nu,p\in\mathbb{Z}_+\) with \(\nu\le p\), \[\hat\tau_{Z,\nu,p}(x;h_n) = \hat\mu^{(\nu)}_{Z+,p}(x;h_n)-\hat\mu^{(\nu)}_{Z-,p}(x;h_n),\] \[\hat\mu^{(\nu)}_{Z+,p}(x;h_n)=\mathbf{e}_\nu'\hat{\boldsymbol{\beta}}_{Z+,p}(x;h_n) \qquad\text{and}\qquad \hat{\mu}^{(\nu)}_{Z-,p}(x;h_n)=\mathbf{e}_\nu'\hat{\boldsymbol{\beta}}_{Z-,p}(x;h_n),\] \[\hat{\boldsymbol{\beta}}_{Z+,p}(x;h_n)=\arg\min_{\boldsymbol{\beta}\in\mathbb{R}^{p+1}}\sum_{i=1}^n\mathbb{1}(X_i\ge x)(Z_i-\mathbf{r}_p(X_i-x)'\boldsymbol{\beta})^2 K_{h_n}(X_i-x),\] \[\hat{\boldsymbol{\beta}}_{Z-,p}(x;h_n)=\arg\min_{\boldsymbol{\beta}\in\mathbb{R}^{p+1}}\sum_{i=1}^n\mathbb{1}(X_i<x)(Z_i-\mathbf{r}_p(X_i-x)'\boldsymbol{\beta})^2 K_{h_n}(X_i-x),\] where here \(\mathbf{r}_p(x)=(1,x,\ldots,x^p)'\), \(\mathbf{e}_\nu\) is the conformable (\(\nu+1\))-th unit vector (e.g., \(\mathbf{e}_1=(0,1,0)'\) if \(p=2\)), \(K_h(u)=K(u/h)/h\) with \(K(\cdot)\) a kernel function and \(h_n\) is a positive bandwidth sequence.

Using the generic notation above, the sharp RD estimators are: \[\hat\tau_{\nu,p}(h_n):=\hat\tau_{Y,\nu,p}(\bar{x};h_n), \qquad \nu\le p.\] Similarly, for the fuzzy RD designs we have the RD estimators: \[\hat\varsigma_{\nu,p}(h_n):=\frac{\hat\tau_{Y,\nu,p}(h_n)}{\hat\tau_{T,\nu,p}(h_n)},\qquad \hat\tau_{Y,\nu,p}(h_n):=\hat\tau_{Y,\nu,p}(\bar{x};h_n),\qquad \hat\tau_{T,\nu,p}(h_n):=\hat\tau_{T,\nu,p}(\bar{x};h_n), \qquad \nu\le p.\]

Assuming the bandwidth \(h_n\to 0\) and other regularity conditions hold, consistency of these estimators follows easily from well-known properties of local polynomial estimators. In applications, the most common choices are \(p=1\) for \(\tau_0\) (local-linear sharp RD estimator), \(p=2\) for \(\tau_1\) (local-quadratic sharp kink RD estimator), \(p=1\) for \(\varsigma_0\) (local-linear fuzzy RD estimator), and \(p=2\) for \(\varsigma_1\) (local-quadratic fuzzy kink RD estimator).

The function rdrobust() implements the above RD point estimators with options c to set \(\bar{x}\), deriv to set \(\nu\), p to set \(p\), kernel to set \(K(\cdot)\), and h to set \(h_n\), among others.

Bandwidth selectors

The main obstacle in the practical implementation of RD local polynomial estimators is bandwidth selection. The package rdrobust implements the main two approaches for bandwidth selection available in the literature: (i) plug-in rules based on mean squared error (MSE) expansions, and (ii) cross validation. IK provide a comprehensive review of these approaches.

The function rdbwselect() implements the above bandwidth selectors.

Asymptotic properties and confidence intervals

We briefly review the main asymptotic properties of the local polynomial RD estimators, with particular emphasis on the properties of the associated confidence interval estimators. Specifically, we discuss three types of confidence intervals (CI) based on Gaussian approximations: (i) conventional CI (assuming “small” bias), (ii) bias-corrected CI (not necessarily requiring undersmoothing), and (iii) robust bias-corrected CI (not necessarily requiring undersmoothing).

The function rdrobust() may be used to conduct inference in all RD settings; by default, this function employs the function rdbwselect() for bandwidth selection. Specifically, assuming \(y\) is the output variable, \(t\) is the treatment status variable, \(x\) is the running variable and the cutoff is \(c=0\), we have the following generic cases (with default options and bandwidth selection procedure):

RD plots

Because of the simplicity of the RD design, it is customary (and advisable) to summarize the main features of the RD design in a graphical way. The package rdrobust also implements the results in Calonico et al. ({in press}), which offer several optimal data-driven choices of tuning parameters useful to produce several versions of the popular RD plots. These plots present global and local estimates of the regression functions, \(\mu_{Y-}(x)\) and \(\mu_{Y+}(x)\), in an attempt to describe their shapes for control (\(X_i<\bar{x})\) and treated (\(X_i\ge\bar{x}\)) units. The plot typically includes two smooth “global” polynomial regression curve estimates, for control and treatment units separately, as well as binned sample means of the outcome, which are included either to capture the local behavior of the underlying regression functions or to represent the overall variability of the raw data in a disciplined way. These binned sample means are used to either (i) investigate whether other discontinuities are present, and (ii) depict an informative “cloud of points” around the smooth global polynomial fits.

The first ingredient of the RD plot (two regression curves estimated for \(X_i<\bar{x}\) and \(X_i\ge\bar{x}\) separately) is easy to construct because it requires only estimating a polynomial regression on the data; typical choices are \(4\)-th and \(5\)-th order global polynomials. The second ingredient of the RD plot requires computing sample means over non-overlapping regions of the support of the running variable \(X_i\) for control and treatment units, separately. For implementation the researcher needs to choose the number of bins to be used, denoted by \(J_{-,n}\) (control) and \(J_{+,n}\) (treatment), and the length of each bin; evenly-spaced bins is the most common partitioning scheme used. Calonico et al. ({in press}) study the problem of selecting an optimal number of bins \(J_{-,n}\) and \(J_{+,n}\) under two partitioning schemes, evenly-spaced (ES) and quantile-spaced (QS), and propose several consistent nonparametric selectors using spacings and polynomial regression estimators. In particular, they propose two approaches to select the number of bins: (i) IMSE-optimal (tailored to approximate the underlying regression functions), and (ii) Mimicking Variance (tailored to represent the overall variability of the data in a disciplined way). These two proposed choices take the form, respectively, \[\text{IMSE-optimal : }\quad J_{-,n}^* = \left\lceil\mathscr{C}_-\;n^{1/3}\right\rceil \quad\text{and} \quad J_{+,n}^* = \left\lceil\mathscr{C}_+\;n^{1/3}\right\rceil,\] and \[\text{Mimicking Variance : }\quad J_{-,n}^* = \left\lceil\mathscr{C}_-\;\frac{n}{\log(n)^2}\right\rceil\quad\text{and} \quad J_{+,n}^* = \left\lceil\mathscr{C}_+\;\frac{n}{\log(n)^2}\right\rceil,\] where \(\lceil\cdot\rceil\) denotes the ceiling function, and the unknown constants take different values depending on the targeted method and partitioning scheme used. Once the partitioning scheme is selected, the optimal choices \(J_{-,n}^*\) and \(J_{+,n}^*\) can be estimated using preliminary plug-in estimators of \(\mathscr{C_-}\) and \(\mathscr{C_+}\).

The function rdplot() offers eight distinct automatic implementations for RD plots depending on (i) the choice of partitioning (ES or QS), (ii) the goal of the plot (IMSE-optimal or Mimicking Variance), and (iii) the estimation approach used (spacings or polynomial regression). Specifically, the function rdplot() covers the following.

Further details on implementation and syntax are given in the help file of the function rdplot(). For other technical and methodological details see Calonico et al. ({in press}).

3 The rdrobust package: Empirical illustration

We employ an extract of the dataset constructed by Cattaneo et al. (2015) to illustrate some of the features of our R package rdrobust. This dataset contains information on elections for the U.S. Senate during the period 1914–2010. We focus on the RD effect of the Democratic party winning a U.S. Senate seat on the vote share obtained in the following election for that same seat, mimicking the analysis conducted in (Lee 2008) for the U.S. House. The dataset rdrobust_RDsenate contains two variables: vote and margin. The variable vote records the state-level vote share of the Democratic party in a given statewide election for a Senate seat, while the variable margin records the margin of victory of the Democratic party in the previous election for the same Senate seat (i.e., six years prior).

First, we load the database and present basic summary statistics. The functions included in the R package rdrobust allow for missing values, which are automatically excluded for estimation purposes.

> library(rdrobust)
> data(rdrobust_RDsenate)
> vote <- rdrobust_RDsenate$vote
> margin <- rdrobust_RDsenate$margin
> summary(vote)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   0.00   42.67   50.55   52.67   61.35  100.00      93 
> summary(margin)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-100.000  -12.210    2.166    7.171   22.770  100.000 

This data set has a total of \(1,297\) complete observations. The variable margin ranges from \(-100\) to 100, and records the margin of victory in a given election for a given U.S. Senate seat, defined as the vote share of the Democratic party minus the vote share of the strongest opponent. When margin is above zero, the Democratic party wins the election for that seat, otherwise it loses. The variable vote ranges from 0 to 100 because it records the outcome of the (two-periods ahead) election for that given seat. Thus, observations for years 2008 and 2010 have missing vote. As it is usual in the literature, we exploit the discontinuity in incumbency status that occurs at 0 on margin to employ an RD design.

We use rdplot() to construct an automatic plot of the RD design.

> (rdplot(y = vote, x = margin, title = "RD Plot - Senate Elections Data",
+   y.label = "Vote Share in Election at time t+1", 
+   x.label = "Vote Share in Election at time t"))
Call:
rdplot(y = vote, x = margin, title = "RD Plot - Senate Elections Data", 
   x.label = "Vote Share in Election at time t", 
   y.label = "Vote Share in Election at time t+1")

Method: mimicking variance evenly-spaced method using spacings estimators


                          Left   Right 
Number of Obs.            595    702   
Polynomial Order          4      4     
Scale                     1      1     
                                       
Selected Bins             15     35    
Bin Length                6.6614 2.8561
                                       
IMSE-optimal bins         8      9     
Mimicking Variance bins   15     35    
                                       
Relative to IMSE-optimal:              
Implied scale             1.8750 3.8889
WIMSE variance weight     0.1317 0.0167
WIMSE bias weight         0.8683 0.9833
graphic without alt text
Figure 1: Automatic RD plot with evenly spaced bins (Mimicking Variance).

Figure 1 is constructed using the default options in the command rdplot, which produce an RD plot with evenly-spaced bins selected to mimic the underlying variability of the data and is implemented using spacings estimators. Using the notation introduced above, the number of optimal bins for control and treatment units are \(\hat{J}_{-,n}=15\) and \(\hat{J}_{+,n}=35\), respectively, implying bin lengths of 6.661 and 2.856 percentage points, respectively. The global polynomial is constructed using a \(4th\) degree polynomial (\(p=4\) for \(\hat{\mu}_{-.p,1}(x)\) and \(\hat{\mu}_{+.p,1}(x)\)).

Next, we construct an alternative RD plot using evenly-spaced bins selected to trace out the underlying regression function (i.e., using the IMSE-optimal selector), also implemented using spacings estimators. The resulting plot is given in Figure 2.

> (rdplot(y = vote, x = margin, binselect = "es",
+   title = "RD Plot - Senate Elections Data", 
+   y.label = "Vote Share in Election at time t+1",
+   x.label = "Vote Share in Election at time t"))
Call:
rdplot(y = vote, x = margin, binselect = "es", x
   title = "RD Plot - Senate Elections Data", 
   x.label = "Vote Share in Election at time t", 
   y.label = "Vote Share in Election at time t+1")

Method: IMSE-optimal evenly-spaced method using spacings estimators


                          Left    Right  
Number of Obs.            595     702    
Polynomial Order          4       4      
Scale                     1       1      
                                         
Selected Bins             8       9      
Bin Length                12.4901 11.1071
                                         
IMSE-optimal bins         8       9      
Mimicking Variance bins   15      35     
                                         
Relative to IMSE-optimal:                
Implied scale             1.0000  1.0000 
WIMSE variance weight     0.5000  0.5000 
WIMSE bias weight         0.5000  0.5000 
graphic without alt text
Figure 2: Automatic RD plot with evenly spaced bins (IMSE-optimal).

While providing a good approximation to the underlying regression function (taking the global polynomial fit as benchmark), the IMSE-optimal number of bins will usually be too small in applications. This happens because the optimal formulas seek to balance squared bias and variance in order to approximate the underlying regression function globally. To obtain a visual “cloud of points” we need to increase the number of bins, that is, undersmooth the estimator. In other words, in order to increase the overall variability of the plotted points, we may reduce the bin-length – which is done by increasing the total number of bins used. This may be easily done using the option scale as follows:

> (rdplot(y = vote, x = margin, binselect = "es", scale = 5, 
+   title = "RD Plot - Senate Elections Data",
+   y.label = "Vote Share in Election at time t+1",
+   x.label = "Vote Share in Election at time t"))
Call:
rdplot(y = vote, x = margin, binselect = "es", scale = 5, 
   title = "RD Plot - Senate Elections Data", 
   x.label = "Vote Share in Election at time t", 
   y.label = "Vote Share in Election at time t+1")

Method: IMSE-optimal evenly-spaced method using spacings estimators


                          Left   Right 
Number of Obs.            595    702   
Polynomial Order          4      4     
Scale                     5      5     
                                       
Selected Bins             40     45    
Bin Length                2.4980 2.2214
                                       
IMSE-optimal bins         8      9     
Mimicking Variance bins   15     35    
                                       
Relative to IMSE-optimal:              
Implied scale             5.0000 5.0000
WIMSE variance weight     0.0079 0.0079
WIMSE bias weight         0.9921 0.9921
graphic without alt text
Figure 3: Automatic RD plot with evenly spaced bins and scaled down bin length (IMSE-optimal).

Figure 3 shows the resulting (undersmoothed) RD plot, where now the number of bins used is five times larger than the optimal choice in an integrated mean squared error sense. The resulting estimator is naturally more variable than before.

Next, we conduct fully data-driven RD treatment effect estimation and inference. The function rdrobust() using its default options leads to the following output:

> rdrobust(y = vote, x = margin)

Call:
rdrobust(y = vote, x = margin)

Summary:
                        
Number of Obs 1297      
NN Matches    3         
BW Type       CCT       
Kernel Type   Triangular

                   Left    Right  
Number of Obs      343     310    
Order Loc Poly (p) 1       1      
Order Bias (q)     2       2      
BW Loc Poly (h)    16.7936 16.7936
BW Bias (b)        27.4372 27.4372
rho (h/b)          0.6121  0.6121 

Estimates:
             Coef   Std. Err. z      P>|z|  CI Lower CI Upper
Conventional 7.4253 1.4954    4.9656 0.0000 4.4944   10.3562 
Robust                               0.0000 4.0697   10.9833 

These results contain a variety of information, which is organized in three panels. The first two contain a summary of the main choices selected to construct the RD treatment effect estimators, while the lower panel includes the main estimation results. Specifically, using the notation introduced above, this table shows:

  1. The total number of observations is \(1,297\), with effective \(343\) control and \(310\) treated units (given the bandwidth \(h_n\) chosen; see below). The estimation is conducted using a local-linear (\(p=1\)) estimator with a local-quadratic (\(q=2\)) bias-correction estimate, with a triangular kernel. The standard error estimators are the ones proposed by CCT, computed using 3 nearest-neighbors.

  2. The bandwidth selection procedure is the one proposed by CCT, leading to \(\hat{h}_{\mathtt{CCT},\nu,p}=16.7936\) with \(p=1\), and \(\hat{b}_{\mathtt{CCT},\nu,p,q}=27.4372\) with \(q=2\). Recall \(\hat{h}_{\mathtt{CCT},\nu,p}\) and \(\hat{b}_{\mathtt{CCT},\nu,p,q}\) are the estimated bandwidths used to construct the RD point estimator and the RD bias-correction, respectively, and \(\nu=0\) in this illustration.

  3. The RD point estimator is \(\hat\tau_p(\hat{h}_{\mathtt{CCT},\nu,p}) = 7.4253\) and the RD robust confidence intervals is \(\hat{\mathsf{CI}}^{rbc}_{1-\alpha}(\hat{h}_{\mathtt{CCT},\nu,p},\hat{b}_{\mathtt{CCT},\nu,p,q}) = [\;4.0697\;,\;10.9833\;]\), with a default choice of \(\alpha=0.05.\)

The function rdrobust() also offers a more detailed output, which includes all the point estimators, standard errors and confidence intervals discussed previously. These results are retrieved using the all = TRUE option. The corresponding output is as follows:

> rdrobust(y = vote, x = margin, all = TRUE)

Call:
rdrobust(y = vote, x = margin, all = TRUE)

Summary:
                        
Number of Obs 1297      
NN Matches    3         
BW Type       CCT       
Kernel Type   Triangular

                   Left    Right  
Number of Obs      343     310    
Order Loc Poly (p) 1       1      
Order Bias (q)     2       2      
BW Loc Poly (h)    16.7936 16.7936
BW Bias (b)        27.4372 27.4372
rho (h/b)          0.6121  0.6121 

Estimates:
               Coef   Std. Err. z      P>|z|  CI Lower CI Upper
Conventional   7.4253 1.4954    4.9656 0.0000 4.4944   10.3562 
Bias-Corrected 7.5265 1.4954    5.0333 0.0000 4.5957   10.4574 
Robust         7.5265 1.7637    4.2675 0.0000 4.0697   10.9833 

Finally, we illustrate all the bandwidth selection procedures contained in our package. To this end, we employ our companion function rdbwselect() to compare the CCT bandwidth selectors with the IK and CV approaches. We have:

> rdbwselect(y = vote, x = margin, all = TRUE)

Call:
rdbwselect(y = vote, x = margin, all = TRUE)
                        
BW Selector   All       
Number of Obs 1297      
NN Matches    3         
Kernel Type   Triangular

                   Left Right
Number of Obs      595  702  
Order Loc Poly (p) 1    1    
Order Bias (q)     2    2    

           h        b
CCT 16.79357 27.43722
IK  15.66761 16.48524
CV  35.42113       NA

In this case we employed the option all = TRUE, which computes the three bandwidth selectors briefly discussed above. Notice that the option CV is currently not available for derivative estimation. To further understand the performance of the CV approach, we include a graph of the CV objective function over the grid being considered. This is done using the option cvplot as shown next (in this example we also changed the grid features to obtain a better plot, and to show this additional functionality in action as well).

> rdbwselect(y = vote, x = margin, bwselect = "CV", 
+   cvgrid_min = 10, cvgrid_max = 80, cvplot = TRUE)

Call:
rdbwselect(y = vote, x = margin, bwselect = "CV", cvgrid_min = 10, 
    cvgrid_max = 80, cvplot = TRUE)
                        
BW Selector   CV        
Number of Obs 1297      
NN Matches    3         
Kernel Type   Triangular

                   Left Right
Number of Obs      595  702  
Order Loc Poly (p) 1    1    
Order Bias (q)     2    2    

     h    b
   34.5 34.5
graphic without alt text
Figure 4: Values of the CV function over the selected grid.

Figure 4 shows the CV objective function as a function of a grid of bandwidth. In this example, the cross validation approach delivers a minimum at \(\hat{h}_{\mathtt{CV},p}=34.5\).

Our functions contained in the R package rdrobust have many other options. For instance, for the main function rdrobust() we have the following additional examples (output is not provided to conserve space).

4 Conclusions

We introduced the main features of the R package rdrobust, which includes the functions rdrobust(), rdbwselect(), and rdplot() designed to conduct data-driven nonparametric robust inference in RD designs. This implementation covers average RD treatment effects at the cutoff in the sharp RD, sharp kink RD, fuzzy RD and fuzzy kink RD designs. A full description of this package may be found in its manual and help files. A companion Stata package offering the same structure and capabilities is described in Calonico, M. D. Cattaneo, and R. Titiunik (2014).

5 Acknowledgments

We thank the Editor Deepayan Sarkar, two anonymous reviewers, Richard Anderson, Devin Caughey and Marko Klašnja for comments and suggestions on previous versions of our R package rdrobust. The authors gratefully acknowledge financial support from the National Science Foundation (SES 1357561).




CRAN packages used

rdrobust

CRAN Task Views implied by cited packages

CausalInference, Econometrics

Note

This article is converted from a Legacy LaTeX article using the texor package. The pdf version is the official version. To report a problem with the html, refer to CONTRIBUTE on the R Journal homepage.

A. Abadie and G. W. Imbens. Large sample properties of matching estimators for average treatment effects. Econometrica, 74(1): 235–267, 2006.
S. Calonico, M. D. Cattaneo, and R. Titiunik. Robust data-driven inference in the regression-discontinuity design. Stata Journal 14 (4): ,natexlabb, 2014.
S. Calonico, M. D. Cattaneo and M. H. Farrell. On the effect of bias estimation on coverage accuracy in nonparametric estimation. University of Michigan. 2015a.
S. Calonico, M. D. Cattaneo and R. Titiunik. Optimal data-driven regression discontinuity plots. Journal of the American Statistical Association, {in press}. DOI 10.1080/01621459.2015.1017578.
S. Calonico, M. D. Cattaneo and R. Titiunik. Rdrobust: Robust data-driven statistical inference in regression-discontinuity designs. 2015b. URL http://CRAN.R-project.org/package=rdrobust. R package version 0.80.
S. Calonico, M. D. Cattaneo and R. Titiunik. Robust nonparametric confidence intervals for regression-discontinuity designs. Econometrica, 82(6): 2295–2326, 2014.
D. Card, D. S. Lee, Z. Pei and A. Weber. Inference on causal effects in a generalized regression kink design. UC Berkley. 2014.
M. D. Cattaneo and M. H. Farrell. Optimal convergence rates, Bahadur representation, and asymptotic normality of partitioning estimators. Journal of Econometrics, 174(2): 127–143, 2013.
M. D. Cattaneo, B. Frandsen and R. Titiunik. Randomization inference in the regression discontinuity design: An application to party advantages in the U.S. Senate. Journal of Causal Inference, 3(1): 1–24, 2015.
J. Fan and I. Gijbels. Local polynomial modelling and its applications. New York: Chapman & Hall/CRC, 1996.
J. Hahn, P. Todd, and W. van der Klaauw. Identification and estimation of treatment effects with a regression-discontinuity design. Econometrica 69 (1):, 2001.
J. J. Heckman and E. J. Vytlacil. Econometric evaluation of social programs, part I: Causal models, structural models and econometric policy evaluation. In J. Heckman; E. Leamer editors Handbook ofEconometrics volume VI pages Elsevier Science B.V., 2007.
G. W. Imbens and J. M. Wooldridge. Recent developments in the econometrics of program evaluation. Journal of Economic Literature 47 (1):, 2009.
G. W. Imbens and K. Kalyanaraman. Optimal bandwidth choice for the regression discontinuity estimator. Review of Economic Studies 79 (3):, 2012.
G. Imbens and T. Lemieux. Regression discontinuity designs: A guide to practice. Journal of Econometrics 142 (2):, 2008.
D. S. Lee and T. Lemieux. Regression discontinuity designs in economics. Journal of Economic Literature 48 (2):, 2010.
D. S. Lee. Randomized experiments from non-random selection in U.S. House elections. Journal of Econometrics 142 (2):, 2008.
J. Porter. Estimation in the regression discontinuity model. Working paper University of Wisconsin, 2003.
StataCorp. Stata data analysis statistical software: Release 13. College Station, TX: StataCorp LP, 2013. URL http://www.stata.com/.
M. Wand and M. Jones. Kernel Smoothing. Chapman & Hall/CRC Florida, 1995.

References

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Calonico, et al., "rdrobust: An R Package for Robust Nonparametric Inference in Regression-Discontinuity Designs", The R Journal, 2015

BibTeX citation

@article{RJ-2015-004,
  author = {Calonico, Sebastian and Cattaneo, Matias D. and Titiunik, Rocío},
  title = {rdrobust: An R Package for Robust Nonparametric Inference in Regression-Discontinuity Designs},
  journal = {The R Journal},
  year = {2015},
  note = {https://rjournal.github.io/},
  volume = {7},
  issue = {1},
  issn = {2073-4859},
  pages = {38-51}
}