Movatterモバイル変換


[0]ホーム

URL:


QTE in RDD

Introduction

TheQTE.RD package provides tools to test, estimate,and conduct uniform inference on quantile treatment effects (QTEs) insharp regression discontinuity (RD) designs. These methods areparticularly useful for detecting and analyzing heterogeneous treatmenteffects.

Instead of focusing solely on average effects, users can assess apolicy’s impact across the entire distribution of an outcome variable.When significant heterogeneity is identified by examining thedistributional effects for the full sample, the package can helppinpoint the source of the heterogeneity by allowing forcovariate-specific effects in the RD design.

The statistical theory underlying these methods was developed byQu and Yoon (2019) andQu,Yoon, and Perron (2024),who introduced uniform inference procedures and robust bias correctionfor QTE in RD designs.QTE.RD implements these methodsin a user-friendly interface.


Scope of this Vignette

This vignette serves as a practical guide for users with somefamiliarity with quantile regression and RD designs. For those seeking amore detailed introduction to the methodology and its applications, werefer toQu and Yoon (2025), which discusses both thetheoretical foundations and the practical use ofQTE.RDin detail.


Getting Started

QTE.RD can be installed from CRAN via

install.packages("QTE.RD")

The package depends onquantreg for quantileregression. If it is not already installed, install it with:install.packages("quantreg").


Overview of the package

After installing theQTE.RD package, it can beloaded by

library(QTE.RD)

The package provides four main functions:

  1. rd.qte() - Estimates QTEs over a range of quantilesusing local-linear regressions and constructs uniform confidence bands.Users can include covariates and apply either no bias correction orrobust bias correction(Qu, Yoon, and Perron2024).

  2. rdq.test() - Tests three hypotheses on treatmenteffects: Treatment Significance, Homogeneity, and Unambiguity. Itsupports covariates and robust bias correction, with critical valuesobtained via simulation.

  3. rdq.bandwidth() - Selects bandwidths using eithercross-validation or MSE-optimal rules. Both can be applied to checkrobustness.

  4. plot.qte() - Produces figures of QTE estimates anduniform confidence bands to visualize estimation and testingresults.


Illustration by Example

For illustration, we apply these functions to study the effect oftracking (assigning students into separate classes based on priorachievement) on student performance. We use a subset of the dataset fromDuflo, Dupas, and Kremer (2011), which is includedin the package and can be loaded with:

data("ddk_2011")

Data and Background

The dataddk_2011 comes from an experiment in 121 Kenyanprimary schools that received funds in 2005 to hire an extra teacher andsplit their single first-grade class into two sections. Schools wererandomly assigned to treatment group, 61 tracking schools, or controlgroup, 60 non-tracking schools. In tracking schools, students wereassigned to upper or lower section based on baseline test scores. Innon-tracking schools, students were randomly assigned.

The experimental design has rich random variations, featuringelements of both randomized controlled trials (RCT) and RD. By comparingtracking and non-tracking schools, that is, by exploiting the RCTstructure, one can study the effect of tracking on all students.Additionally, by analyzing median students within tracking schools, thatis, by exploiting the RD structure, one can study the effect of trackingon marginal students who barely made or missed the opportunity of beingassigned to a high ability section.

This vignette will focus on the RD-based evidence, which providesinsight into how tracking affects students at the margin. Readersinterested in the RCT-based evidence can find a more detailed analysisinQu and Yoon (2025).

The experiment lasted 18 months. The outcome is the sum of math andlanguage scores on endline tests, and the running variable for RD isstudent’s percentile rank from the baseline test. To exploreheterogeneity in treatment effects, we include baseline test scores,gender, age at the endline test, and teacher status (civil servantvs. contract) as covariates.


Variables

Define some key variables:

trk<- ddk_2011$trackingcon<- ddk_2011$etpteacherhgh<- ddk_2011$highstreamyy<- ddk_2011$ts_stdxx<- ddk_2011$percentile

There are three indicator variables;trk takes 1 fortracking schools (and 0 for non-tracking schools),contakes 1 for students assigned to a contract teacher,hghtakes 1 for students assigned to high-achieving sections (if in trackingschools). The variableyy is the endline test scoresnormalized by the mean and standard deviation of non-tracking schoolsandxx is student’s percentile rank from the baseline test.Because the outcome variable is normalized, the unit of the effect is astandard deviation of the endline test score (of non-trackingschools).


RDD

We focus on tracking schools to evaluate the effects of trackingusing the RD design. Specifically, we examine students near the medianof the baseline test score, comparing those who just qualified for theupper section to those who narrowly missed it. The outcome and runningvariables (yc andxc below) include onlystudents from tracking schools. The cutoff is the median of the baselinepercentile (x0 = 50), and the treatment indicator(dc below) equals 1 for students placed in thehigh-achieving section.

yc<- yy[trk==1]xc<- xx[trk==1]dc<- hgh[trk==1]x0<-50tlevel<-1:9/10hh<-20

The last two lines set the values of two parameters;tlevel defines the range of quantile index to be [0.1,0.9]andhh is the bandwidth at the median of the outcomedistribution.


QTE from RDD without covariates

Inrd.qte(), whenx includes the runningvariable only andz0 is unspecified, one can estimatequantile effects atx0 without covariate.

A<-rd.qte(y=yc,x=xc,d=dc,x0,z0=NULL,tau=tlevel,bdw=hh,bias=1)A2<-summary(A,alpha=0.1)A2#>#>#>                                  QTE#> ----------------------------------------------------------------------#>              Bias cor.    Pointwise         Uniform#>     Tau         Est.     Robust S.E.    90% Conf. Band#>      0.1      -0.104       0.140      -0.436       0.227#>      0.2      -0.001       0.145      -0.343       0.341#>      0.3      -0.068       0.153      -0.430       0.294#>      0.4      -0.074       0.161      -0.455       0.307#>      0.5      -0.157       0.186      -0.596       0.283#>      0.6      -0.069       0.225      -0.603       0.464#>      0.7      -0.020       0.276      -0.673       0.634#>      0.8      -0.023       0.318      -0.776       0.729#>      0.9      -0.003       0.268      -0.636       0.631

The outcome table shows some essential elements of the analysisincluding point estimates of QTE, standard errors, and uniformconfidence bands. Because the bias option is activated,bias=1, the table reports the bias corrected point estimateand the robust standard error and robust uniform band. Ifbias=0, one would obtain QTE estimates and uniform bandswithout the bias correction. In the second line,alpha=0.1,so a 90% uniform confidence band is reported. Ifalpha=0.05, one would get a 95% uniform confidenceband.

The estimated quantile effects are small in magnitude (the maximumeffect is -0.157 standard deviation when\(\tau=0.5\)) and the uniform confidence bandincludes zero throughout the quantile range. This confirms a finding inDuflo, Dupas, and Kremer (2011) who concluded that``the median student in tracking schools scores similarly whetherassigned to the upper or lower section.’’ The QTE estimate provides evenstronger evidence that not only on average but also on the entireendline score distribution, students near the median of the initial testscores fare similarly regardless of whether they were assigned to theupper or lower ability section.

To examine the shape of the effect graphically,plot.qte() function can be used to produce QTE plots alongwith uniform confidence bands.

y.text<-"test scores"m.text<-"Effects of assignment to lower vs. upper sections"plot(A2,ytext=y.text,mtext=m.text)


It is of interest to examine the conditional quantile functions fromtwo sides of the cutoff. The functionplot.qte() can makesuch plots with the optionptype=2. The inputs forconditional quantile plots include estimates for two conditionalquantile functions,qp andqm, and theiruniform bands,bandp andbandm. These outputsare produced bysummary.qte() and already saved inA2, as the next example shows.

y.text<-"test scores"m.text<-"Conditional quantile functions"sub.text<-c("Upper section","Lower section")plot(A2,ptype=2,ytext=y.text,mtext=m.text,subtext=sub.text)


To test the (lack of) effect, one can use therdq.test()function. Whenalpha=c(0.1,0.05), it provides criticalvalues at the 10% and 5% levels. Thetype option determinesthe type of tests to be conducted. To test the treatment significance,settype=1 and to test the treatment homogeneityhypothesis, change it totype=2. For the unambiguityhypothesis with the effects unambiguously positive (or negative) underthe null hypothesis, settype=3 (ortype=4).These options can be combined: the lines below settype=c(1,2,3,4), leading to tests for all fourhypotheses.

B<-rdq.test(y=yc,x=xc,d=dc,x0,z0=NULL,tau=tlevel,bdw=hh,bias=1,alpha=c(0.1,0.05),type=c(1,2,3,4),std.opt=1)B#>#>#>                      Testing hypotheses on quantile process#> --------------------------------------------------------------------------------#> NULL Hypthoesis                            test stat.  critical value   p value#>                                                         10%       5%#> ================================================================================#> Significance: QTE(tau|x,z)=0 for all taus      0.87     2.42     2.70     0.93#> Homogeneity: QTE(tau|x,z) is constant          0.52     1.86     2.09     0.98#> Dominance: QTE(tau|x,z)>=0 for all taus        0.87     2.08     2.42     0.58#> Dominance: QTE(tau|x,z)<=0 for all taus        0.00     2.10     2.42     1.00

Whenstd.opt=1, the test statistic is standardized bythe pointwise standard deviations of the limiting process. As a result,the quantiles that are estimated imprecisely receive less weight in theconstruction. Whenstd.opt=0, the tests are notstandardized. The default isstd.opt=1.

The outcome table displays the null hypotheses to be tested, teststatistics, critical values, and p-values. All four tests indicate thatQTEs are likely to be zero over the entire quantile range.

The empirical evidence from the RDD indicates that there is nodifference in endline achievement between marginal students regardlessof whether they were assigned to the upper or lower section. Becausestudents in the upper section had much higher achieving peers, thisimplies that there may be a factor that offsets the positive peereffect. One possibility is that tracking may allow teachers to adjusttheir instruction to students’ needs.Duflo,Dupas, and Kremer (2011) explored thispotential channel and documented evidence that teachers had incentivesto focus on the students at the top of the distribution.

The bandwidth (at the median) can be estimated as follows.

C<-rdq.bandwidth(y=yc,x=xc,d=dc,x0,z0=NULL,cv=1,val=(5:20),pm.each=0)C#>#>#>                     Selected Bandwidths#> ------------------------------------------------------------#> Method                               Values#> ============================================================#> Cross Validation                        20#> MSE Optimal                           16.3         16.0

The cross-validation option is enabled bycv=1, so thetable reports both CV and MSE optimal bandwidths. The candidatebandwidth values for cross-validation are set to\(\{5,6,\ldots,20\}\) byval=(5:20). In this example, bandwidth 20 (at the median)was selected by the cross-validation method and used accordingly.

For very large samples, computing the CV bandwidth may take a longtime. In such a case, setcv=0 and use the MSE optimalbandwidth at least for the initial stage of data exploration. Thefunctionrdq.bandwidth() offers flexibility by allowingusers to adjust several option arguments; seeQuand Yoon (2025) for moredetails.


QTE from RDD with covariates

To see heterogeneity in the effect of tracking, one can includeadditional covariates. This section compares effects of tracking forboys and girls. The covariatezc is a female dummy and theevaluation point\(z_0\) is set byz.eval = c(0,1). The order of display in the outcome tableis the same as the order of the group in\(z_0\).

zc<- ddk_2011$girl[trk==1]z.eval<-c(0,1)A<-rd.qte(y=yc,x=cbind(xc,zc),d=dc,x0,z0=z.eval,tau=tlevel,bdw=hh,bias=1)A2<-summary(A,alpha=0.1)A2#>#>#>                                  QTE#> ----------------------------------------------------------------------#>              Bias cor.    Pointwise         Uniform#>     Tau         Est.     Robust S.E.    90% Conf. Band#> ----------------------------------------------------------------------#>  Group-1#>      0.1       0.295       0.186      -0.155       0.745#>      0.2       0.090       0.221      -0.444       0.624#>      0.3       0.063       0.213      -0.449       0.576#>      0.4      -0.026       0.237      -0.599       0.547#>      0.5       0.031       0.284      -0.655       0.717#>      0.6       0.353       0.335      -0.454       1.161#>      0.7       0.597       0.371      -0.298       1.492#>      0.8       0.160       0.469      -0.972       1.292#>      0.9       0.159       0.399      -0.805       1.123#> ----------------------------------------------------------------------#>  Group-2#>      0.1      -0.406       0.145      -0.752      -0.059#>      0.2      -0.161       0.201      -0.641       0.318#>      0.3      -0.100       0.220      -0.625       0.425#>      0.4      -0.233       0.245      -0.818       0.352#>      0.5      -0.475       0.268      -1.115       0.165#>      0.6      -0.291       0.287      -0.977       0.395#>      0.7      -0.158       0.348      -0.989       0.674#>      0.8      -0.236       0.420      -1.239       0.767#>      0.9       0.000       0.317      -0.756       0.756

Becausez.eval <- c(0,1) and\(z_0 = 0\) means boys, the outcome tableshows results for boys first (shown as Group-1) and girls later(Group-2). For boys, the quantile effects of being in the upper abilitysection is positive but insignificant. For girls, the effects are mostlynegative and insignificant. But at the bottom of the outcomedistribution, when\(\tau = 0.1\), thenegative effect turns to be significant.

To see the group-wise difference graphically, one can draw QTE plotsas follows.

y.text<-"test scores"m.text<-c("Boys","Girls")plot(A2,ytext=y.text,mtext=m.text)

The plot clearly shows that tracking has positive but insignificanteffect for marginal male students, but the effect is negative formarginal female students and significantly so at the left tail. Toexplore further, it will be useful to draw plots for the conditionalquantile functions (by settingptype=2) separately for eachgroup.

y.text<-"test scores"m.text<-c("Boys","Girls")sub.text<-c("Upper section","Lower section")plot(A2,ptype=2,ytext=y.text,mtext=m.text,subtext=sub.text)

The plot shows that for girls, the conditional quantile function ofendline test scores for the upper section is consistently below that ofthe lower section, and the difference is largest at the left tail.

Tests for hypotheses for each group can be done as well.

B<-rdq.test(y=yc,x=cbind(xc,zc),d=dc,x0,z0=z.eval,tau=tlevel,bdw=hh,bias=1,alpha=c(0.1,0.05),type=c(1,2,3,4))B#>#>#>                      Testing hypotheses on quantile process#> --------------------------------------------------------------------------------#> NULL Hypthoesis                            test stat.  critical value   p value#>                                                         10%       5%#> ================================================================================#>  Group-1#> Significance: QTE(tau|x,z)=0 for all taus      1.62     2.35     2.60     0.44#> Homogeneity: QTE(tau|x,z) is constant          1.15     1.85     2.19     0.52#> Dominance: QTE(tau|x,z)>=0 for all taus        0.11     2.01     2.24     0.88#> Dominance: QTE(tau|x,z)<=0 for all taus        1.62     2.10     2.39     0.24#> --------------------------------------------------------------------------------#>  Group-2#> Significance: QTE(tau|x,z)=0 for all taus      2.88     2.37     2.63    0.022#> Homogeneity: QTE(tau|x,z) is constant          1.15     1.98     2.27     0.59#> Dominance: QTE(tau|x,z)>=0 for all taus        2.88     2.07     2.39    0.013#> Dominance: QTE(tau|x,z)<=0 for all taus     0.00014     2.09     2.35     0.89

The results indicate that it is not possible to reject hypothesesthat the QTE is consistently zero for boys, but there is evidence thatthe effects can be negative for girls. For female students the nullhypothesis of no effect (significance) and positive uniform effect(dominance) are rejected at the 5% confidence level.

The bandwidth can be selected as well.

C<-rdq.bandwidth(y=yc,x=cbind(xc,zc),d=dc,x0,z0=z.eval,cv=1,val=(5:20),pm.each=0)C#>#>#>                     Selected Bandwidths#> ------------------------------------------------------------#> Method                               Values#> ============================================================#> Cross Validation                        19#> MSE Optimal,Group-1                   14.0         14.2#> MSE Optimal,Group-2                   17.8         20.0

When users would like to see the effect of the bias correction onpoint estimates and uniform bands, it will be convenient to use thefunctionrdq.band(). Its options are the same as those inrd.qte(). The difference is that it implements estimationwith and without bias correction and present results side by side.

D<-rdq.band(y=yc,x=cbind(xc,zc),d=dc,x0,z0=z.eval,tau=tlevel,bdw=hh,alpha=0.1)D#>#>#>                         QTE and Uniform Bands#> ----------------------------------------------------------------------#>                      Bias cor.         90% Uniform Conf. Band#>    Tau        Est.      Est.       Non-robust            Robust#> ----------------------------------------------------------------------#>  Group-1#>      0.1     0.118     0.295    -0.209     0.445    -0.145     0.734#>      0.2     0.014     0.090    -0.362     0.389    -0.444     0.624#>      0.3     0.022     0.063    -0.326     0.369    -0.423     0.550#>      0.4    -0.023    -0.026    -0.424     0.379    -0.576     0.524#>      0.5     0.044     0.031    -0.427     0.516    -0.627     0.688#>      0.6     0.093     0.353    -0.460     0.646    -0.417     1.124#>      0.7     0.194     0.597    -0.426     0.814    -0.258     1.452#>      0.8     0.096     0.160    -0.679     0.871    -0.910     1.230#>      0.9     0.267     0.159    -0.416     0.950    -0.799     1.117#> ----------------------------------------------------------------------#>  Group-2#>      0.1    -0.204    -0.406    -0.466     0.057    -0.739    -0.072#>      0.2    -0.111    -0.161    -0.469     0.247    -0.617     0.294#>      0.3    -0.128    -0.100    -0.532     0.275    -0.594     0.394#>      0.4    -0.186    -0.233    -0.642     0.270    -0.797     0.331#>      0.5    -0.335    -0.475    -0.838     0.168    -1.109     0.159#>      0.6    -0.136    -0.291    -0.676     0.404    -0.979     0.397#>      0.7    -0.142    -0.158    -0.797     0.513    -0.989     0.673#>      0.8    -0.148    -0.236    -0.942     0.646    -1.271     0.799#>      0.9     0.085     0.000    -0.520     0.689    -0.788     0.788

Without bias correction, the effect for girls at the 10-th percentileis no longer statistically significant, as the estimate is smaller.Otherwise, the conclusion does not change.


Concluding Remarks

In this vignette, we illustrated theQTE.RD packageusing a binary covariate in the RD setup. The scope of the analysis canbe broadened, and the exploration of heterogeneity becomes moreinteresting when incorporating a continuous covariate or a combinationof both discrete and continuous covariates. Further details can be foundinQu and Yoon (2025). Readers interested inRCT-based evidence on tracking may also refer to the more detailedanalysis inQu and Yoon (2025).


References

Duflo, Esther, Pascaline Dupas, and Michael Kremer. 2011.“PeerEffects, Teacher Incentives, and the Impact of Tracking: Evidence from aRandomized Evaluation in Kenya.”American EconomicReview 101 (5): 1739–74.https://doi.org/10.1257/aer.101.5.1739.
Qu, Zhongjun, and Jungmo Yoon. 2019.“Uniform Inference onQuantile Effects Under Sharp Regression Discontinuity Designs.”Journal of Business and Economic Statistics 37 (4): 625–47.https://doi.org/10.1080/07350015.2017.1407323.
———. 2025.“QTE.RD: An r Package for Quantile Treatment Effects inRegression-Discontinuity Designs.”https://sites.google.com/site/jungmoyoon2/research.
Qu, Zhongjun, Jungmo Yoon, and Pierre Perron. 2024.Inference on Conditional Quantile Processes in PartiallyLinear Models with Applications to the Impact of UnemploymentBenefits.”The Review of Economics andStatistics, March, 521–41.https://doi.org/10.1162/rest_a_01168.

[8]ページ先頭

©2009-2025 Movatter.jp