unc_qte: unc_qte

View source: R/unc_qte.R

unc_qteR Documentation

unc_qte

Description

Estimates the Quantile Treatment Effect (QTE) or Quantile Treatment Effect on the Treated (QTT) under unconfoundedness, also known as selection on observables. The key identifying assumption is (Y(0), Y(1)) \perp D \mid X, i.e., potential outcomes are independent of treatment conditional on covariates X.

Three estimation methods are available via est_method:

"ipw"

Propensity-score reweighting (Firpo 2007). The propensity score p(X) = P(D=1|X) is estimated by logit or probit and used to reweight the sample so that the covariate distributions of the treated and untreated groups match. For the QTE, both groups are reweighted toward the population distribution; for the QTT, only the untreated group is reweighted toward the treated covariate distribution.

"or"

Outcome regression via quantile regression inversion. rq is fit on a dense internal grid of \tau values, yielding a conditional quantile function Q_{Y|X,D=j}(\tau) for each arm j. The marginal distribution is recovered by averaging conditional quantile functions over the empirical covariate distribution (Melly 2006; Chernozhukov, Fernandez-Val, and Melly 2013).

"aipw"

Doubly-robust augmented IPW. Combines the propensity score model with the conditional quantile outcome model. The CDF estimator is consistent if either the propensity score or the outcome model is correctly specified (semiparametric efficiency when both are correct).

When xformla = ~1 (the default), all three methods reduce to simple quantile differences between the treated and untreated groups, which is consistent under unconditional unconfoundedness. Covariates are required for covariate-adjusted estimation.

Standard errors and uniform confidence bands are computed via the empirical bootstrap. Setting biters = 0 is planned for a future version to skip inference and return point estimates only.

Usage

unc_qte(
  yname,
  dname,
  data,
  xformla = ~1,
  weightsname = NULL,
  probs = seq(0.05, 0.95, 0.05),
  alp = 0.05,
  biters = 100,
  cband = TRUE,
  boot_type = "empirical",
  method = c("logit", "probit"),
  est_method = c("ipw", "or", "aipw"),
  target = c("qte", "qtt"),
  cl = 1
)

Arguments

yname

character; name of the outcome variable in data.

dname

character; name of the binary treatment indicator in data (1 = treated, 0 = untreated).

data

data.frame containing the analysis data.

xformla

one-sided formula for covariates used in the propensity score and/or outcome model, e.g. ~ age + I(age^2) + education. Default ~1 uses no covariates (simple quantile differences).

weightsname

character; name of a column in data containing sampling weights. Default NULL applies equal weights.

probs

numeric vector of quantile levels at which to evaluate the QTE or QTT. Default seq(0.05, 0.95, 0.05).

alp

significance level for confidence intervals. Default 0.05.

biters

number of bootstrap iterations for standard errors and confidence bands. Default 100.

cband

logical; if TRUE (default), report a uniform confidence band (simultaneous over all quantiles in probs) in addition to pointwise intervals.

boot_type

bootstrap variant. Currently only "empirical" is supported.

method

propensity score link function: "logit" (default) or "probit". Used by est_method = "ipw" and "aipw".

est_method

estimation method; one of:

  • "ipw" (default) — inverse propensity weighting

  • "or" — outcome regression via quantile regression inversion

  • "aipw" — doubly-robust augmented IPW

target

target parameter; one of:

  • "qte" (default) — population QTE: Q_{Y(1)}(\tau) - Q_{Y(0)}(\tau)

  • "qtt" — QTT (effect on the treated): Q_{Y(1)|D=1}(\tau) - Q_{Y(0)|D=1}(\tau)

cl

number of cores for parallel bootstrap. Default 1 (sequential).

Value

An object of class QTE containing:

qte

numeric vector of estimated QTE (or QTT) at each element of probs.

ate

estimated ATE (or ATT when target = "qtt").

qte.se

bootstrap standard errors for qte.

qte.lower, qte.upper

confidence interval bounds for qte; uniform when cband = TRUE, pointwise otherwise.

ate.se, ate.lower, ate.upper

SE and CI for ate.

probs

the probs vector passed by the user.

pscore.reg

fitted propensity score glm object, or NULL when est_method = "or" or xformla = ~1.

Use summary() to print a formatted table and plot() to display the QTE curve with confidence bands.

References

Firpo, Sergio. “Efficient Semiparametric Estimation of Quantile Treatment Effects.” Econometrica 75(1), pp. 259–276, 2007.

Melly, Blaise. “Estimation of Counterfactual Distributions Using Quantile Regression.” Working paper, University of St. Gallen, 2006.

Chernozhukov, Victor, Ivan Fernandez-Val, and Blaise Melly. “Inference on Counterfactual Distributions.” Econometrica 81(6), pp. 2205–2268, 2013.

Examples

data(lalonde)

## IPW, no covariates (simple quantile differences)

q1 <- unc_qte(yname = "re78", dname = "treat", data = lalonde.psid,
              biters = 20, probs = seq(0.05, 0.95, 0.05))
summary(q1)
plot(q1)


## OR with covariates, QTE

xf <- ~ age + I(age^2) + education + black + hispanic + married + nodegree
q2 <- unc_qte(yname = "re78", dname = "treat", data = lalonde.psid,
              xformla = xf, est_method = "or",
              biters = 20, probs = seq(0.05, 0.95, 0.05))
summary(q2)


## AIPW with covariates, QTT

q3 <- unc_qte(yname = "re78", dname = "treat", data = lalonde.psid,
              xformla = xf, est_method = "aipw", target = "qtt",
              biters = 20, probs = seq(0.05, 0.95, 0.05))
summary(q3)



qte documentation built on July 23, 2026, 5:13 p.m.