make.band {QTE.RD}R Documentation

Uniform confidencedevtools::submit_cran() bands

Description

make.band constructs uniform confidence bands using the output of rdq.sim. The function rdq.band calls this function to generates uniform bands.

Usage

make.band(n.sam,Dc.p,Dc.m,Dr.p,Dr.m,dz,cov,taus,hh,Qy.p,Qy.m,
     bias.p,bias.m,alpha,n.sim)

Arguments

n.sam

the sample size.

Dc.p

simulated values from D_{1,v}(x_{0}^{+},z,\tau).

Dc.m

simulated values from D_{1,v}(x_{0}^{-},z,\tau).

Dr.p

simulated values from D_{1,v}(x_{0}^{+},z,\tau) - D_{2,v}(x_{0}^{+},z,\tau).

Dr.m

simulated values from D_{1,v}(x_{0}^{-},z,\tau) - D_{2,v}(x_{0}^{-},z,\tau).

dz

the number of covariates

cov

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

taus

a vector of quantiles of interest.

hh

the bandwidth values.

Qy.p

estimated conditional quantiles at (x_{0}^{+},z).

Qy.m

estimated conditional quantiles at (x_{0}^{-},z).

bias.p

estimated bias terms at (x_{0}^{+},z).

bias.m

estimated bias terms at (x_{0}^{-},z).

alpha

a number between 0 and 1, the desired significance level.

n.sim

the number of simulation repetitions.

Value

A list with elements:

qte

QTE estimates without bias correction.

qte.r

QTE estimates with bias correction.

uband

uniform confidence band for QTE without bias correction.

uband.r

uniform confidence band for QTE with robust bias correction.

sig

standard errors for the bias-uncorrected QTE estimates.

sig.r

standard errors for the bias-corrected QTE estimates. The values reflect the impact of the bias correction on the estimation precision.

See Also

rdq.band()

Examples

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)
tlevel2 = c(0.05,tlevel,0.95)
hh = rep(2,length(tlevel))
hh2 = rep(2,length(tlevel2))
sel = tlevel2 %in% tlevel

ab = rdq(y=y,x=x,d=d,x0=0,z0=NULL,tau=tlevel2,h.tau=hh2,cov=0)
delta = c(0.05,0.09,0.14,0.17,0.19,0.17,0.14,0.09,0.05)
fp = rdq.condf(x=x,Q=ab$qp.est,bcoe=ab$bcoe.p,taus=tlevel,taul=tlevel2,delta=delta,cov=0)
fm = rdq.condf(x=x,Q=ab$qm.est,bcoe=ab$bcoe.m,taus=tlevel,taul=tlevel2,delta=delta,cov=0)
bp = rdq.bias(y[d==1],x[d==1],dz=0,x0=0,z0=NULL,taus=tlevel,hh,hh,fx=fp$ff[(d==1),],cov=0)
bm = rdq.bias(y[d==0],x[d==0],dz=0,x0=0,z0=NULL,taus=tlevel,hh,hh,fx=fm$ff[(d==0),],cov=0)

sa = rdq.sim(x=x,d=d,x0=0,z0=NULL,dz=0,cov=0,tt=tlevel,hh,hh,fxp=fp$ff,fxm=fm$ff,n.sim=200)
ba = make.band(n,Dc.p=sa$dcp,Dc.m=sa$dcm,Dr.p=sa$drp,Dr.m=sa$drm,dz=0,cov=0,
taus=tlevel,hh,Qy.p=as.matrix(ab$qp.est[sel,]),Qy.m=as.matrix(ab$qm.est[sel,]),
bias.p=bp$bias,bias.m=bm$bias,alpha=0.1,n.sim=200)


[Package QTE.RD version 1.0.0 Index]