Skip to contents

rdq estimates QTE under the RDD with or without covariates. This function is used by rd.qte to generate QTE estimates.

Usage

rdq(y, x, d, x0, z0 = NULL, tau, h.tau, cov)

Arguments

y

a numeric vector, the outcome variable.

x

a vector (or a matrix) of covariates, the first column is the running variable.

d

a numeric vector, the treatment status.

x0

the cutoff point.

z0

the value of the covariates at which to evaluate the effects. For example, if a female dummy is included, z0 = 1 may indicate the female subgroup.

tau

a vector of quantiles of interest.

h.tau

the bandwidth values (specified for each quantile level).

cov

either 0 or 1. Set cov=1 if covariates are present in the model; otherwise set cov=0.

Value

A list with elements:

qte

QTE estimates.

qp.est

conditional quantile estimates on the right side of \(x_{0}\) (or for the D=1 group).

qm.est

conditional quantile estimates on the left side of \(x_{0}\) (or for the D=0 group).

bcoe.p

quantile regression coefficients on the right side of \(x_{0}\).

bcoe.m

quantile regression coefficients on the left side of \(x_{0}\).

Examples

# Without covariate
n = 500
x = runif(n,min=-4,max=4)
d = (x > 0)
y = x + 0.3*(x^2) - 0.1*(x^3) + 1.5*d + rnorm(n)
tlevel = seq(0.1,0.9,by=0.1)
hh = rep(2,length(tlevel))
rdq(y=y,x=x,d=d,x0=0,z0=NULL,tau=tlevel,h.tau=hh,cov=0)
#> $qte
#>           [,1]
#>  [1,] 1.153096
#>  [2,] 1.526869
#>  [3,] 1.301352
#>  [4,] 1.435172
#>  [5,] 1.115538
#>  [6,] 1.331745
#>  [7,] 1.527188
#>  [8,] 1.804409
#>  [9,] 1.818972
#> 
#> $qp.est
#>              [,1]
#>  [1,] -0.01934923
#>  [2,]  0.68049757
#>  [3,]  0.79369693
#>  [4,]  1.11818522
#>  [5,]  1.27177962
#>  [6,]  1.77692947
#>  [7,]  2.12921009
#>  [8,]  2.54873208
#>  [9,]  2.90461042
#> 
#> $qm.est
#>             [,1]
#>  [1,] -1.1724450
#>  [2,] -0.8463718
#>  [3,] -0.5076549
#>  [4,] -0.3169866
#>  [5,]  0.1562418
#>  [6,]  0.4451841
#>  [7,]  0.6020221
#>  [8,]  0.7443226
#>  [9,]  1.0856382
#> 
#> $bcoe.p
#>              [,1]
#>  [1,] -0.01934923
#>  [2,]  0.68049757
#>  [3,]  0.79369693
#>  [4,]  1.11818522
#>  [5,]  1.27177962
#>  [6,]  1.77692947
#>  [7,]  2.12921009
#>  [8,]  2.54873208
#>  [9,]  2.90461042
#> 
#> $bcoe.m
#>             [,1]
#>  [1,] -1.1724450
#>  [2,] -0.8463718
#>  [3,] -0.5076549
#>  [4,] -0.3169866
#>  [5,]  0.1562418
#>  [6,]  0.4451841
#>  [7,]  0.6020221
#>  [8,]  0.7443226
#>  [9,]  1.0856382
#> 

# (continued) With covariates
z = sample(c(0,1),n,replace=TRUE)
y = x + 0.3*(x^2) - 0.1*(x^3) + 1.5*d + d*z + rnorm(n)
rdq(y=y,x=cbind(x,z),d=d,x0=0,z0=c(0,1),tau=tlevel,h.tau=hh,cov=1)
#> $qte
#>           [,1]     [,2]
#>  [1,] 1.880338 1.667822
#>  [2,] 2.182650 2.152383
#>  [3,] 2.039426 2.112467
#>  [4,] 2.493032 2.572881
#>  [5,] 2.269768 2.890846
#>  [6,] 1.988534 3.865975
#>  [7,] 1.694334 3.348729
#>  [8,] 1.815160 3.421151
#>  [9,] 1.719225 3.104595
#> 
#> $qp.est
#>            [,1]      [,2]
#>  [1,] 0.5493202 0.8373678
#>  [2,] 0.7977957 1.4799801
#>  [3,] 0.9147745 1.5450815
#>  [4,] 1.6715846 2.3052193
#>  [5,] 1.6963787 2.5927565
#>  [6,] 1.9444055 3.6764985
#>  [7,] 2.0066870 3.7075433
#>  [8,] 2.2761333 3.9771163
#>  [9,] 2.7464395 4.0287264
#> 
#> $qm.est
#>              [,1]       [,2]
#>  [1,] -1.33101747 -0.8304538
#>  [2,] -1.38485479 -0.6724029
#>  [3,] -1.12465189 -0.5673859
#>  [4,] -0.82144693 -0.2676613
#>  [5,] -0.57338926 -0.2980893
#>  [6,] -0.04412885 -0.1894764
#>  [7,]  0.31235283  0.3588141
#>  [8,]  0.46097339  0.5559651
#>  [9,]  1.02721460  0.9241309
#> 
#> $bcoe.p
#>            [,1]      [,2]
#>  [1,] 0.5493202 0.2880477
#>  [2,] 0.7977957 0.6821844
#>  [3,] 0.9147745 0.6303070
#>  [4,] 1.6715846 0.6336347
#>  [5,] 1.6963787 0.8963778
#>  [6,] 1.9444055 1.7320930
#>  [7,] 2.0066870 1.7008563
#>  [8,] 2.2761333 1.7009830
#>  [9,] 2.7464395 1.2822869
#> 
#> $bcoe.m
#>              [,1]        [,2]
#>  [1,] -1.33101747  0.50056365
#>  [2,] -1.38485479  0.71245193
#>  [3,] -1.12465189  0.55726602
#>  [4,] -0.82144693  0.55378566
#>  [5,] -0.57338926  0.27529994
#>  [6,] -0.04412885 -0.14534758
#>  [7,]  0.31235283  0.04646130
#>  [8,]  0.46097339  0.09499174
#>  [9,]  1.02721460 -0.10308365
#>