Skip to contents

Computes and plots the Qini curve and Area Under the Uplift Curve (AUUC), which measure the quality of treatment effect heterogeneity estimates for targeting / policy evaluation. Compares a CATE-based targeting rule against random assignment and perfect targeting benchmarks.

Usage

qini_curve(
  cate_hat,
  Y,
  W,
  compare_random = TRUE,
  compare_oracle = FALSE,
  n_bins = 100,
  conf_level = 0.95,
  boot_reps = 500,
  seed = 42
)

Arguments

cate_hat

Numeric vector of estimated CATEs.

Y

Numeric vector. Observed outcomes.

W

Numeric vector. Binary treatment assignment (0 or 1).

compare_random

Logical. If TRUE (default), plot the random targeting baseline.

compare_oracle

Logical. If FALSE (default), do not plot an oracle curve (true CATEs rarely available).

n_bins

Integer. Number of bins for the curve. Default 100.

conf_level

Numeric. Confidence level for bootstrap CI on AUUC. Default 0.95.

boot_reps

Integer. Bootstrap replicates for AUUC CI. Default 500.

seed

Integer. Random seed. Default 42.

Value

A list with:

auuc

Numeric. Area under the Qini curve (normalized 0-1).

auuc_ci

Numeric vector of length 2. Bootstrap confidence interval for AUUC.

qini_df

Data frame with columns fraction, uplift.

plot

ggplot2 Qini curve plot.

Details

The Qini curve plots the fraction of treated units (ranked by estimated CATE, highest first) against the cumulative incremental outcome (uplift). The AUUC normalizes this to a value between 0 and 1, relative to the perfect oracle. Values above 0.5 indicate better-than-random targeting.

References

Radcliffe, N. J. (2007). Using control groups to target on predicted lift: Building and assessing uplift models. Direct Marketing Analytics Journal, 1(3), 14-21.

Athey, S., & Imbens, G. W. (2017). The econometrics of randomized experiments. In Handbook of Economic Field Experiments (Vol. 1, pp. 73-140). North-Holland.

Examples

if (FALSE) { # \dontrun{
library(grf)
n <- 1000; p <- 5
X <- matrix(rnorm(n * p), n, p)
W <- rbinom(n, 1, 0.5)
tau <- pmax(X[, 1], 0)
Y   <- tau * W + rnorm(n)
cf  <- causal_forest(X, Y, W)
tau_hat <- predict(cf)$predictions

result <- qini_curve(tau_hat, Y, W)
result$plot
result$auuc
} # }