σ StatsDoge Causal inference workflows
8
Workflow·5 steps·branched

Qini curves: automatic cost-benefit analysis

Source grf — Athey, Tibshirani & Wager
Summary by StatsDoge

From CATEs to a budgeted treatment policy: causal forest → DR scores → cost matrix → maq Qini curve → pick the budget.

1

Input · what goes in

CATEs for one or more treatment arms, plus per-unit-per-arm costs.

Show data format & exampleHide example

Format — one row per unit. Covariates X, a treatment factor W with K arms, and outcome Y; optionally a per-arm cost.

  X1    X2   W       Y
 0.4  -1.1  armA   3.1
-0.1   0.6  ctrl   1.8
 1.2   0.3  armB   4.0
2

Pipeline · the recipe ⑂ has parallel branches

↑ Click any step in the diagram to read its logic, code, assumptions & discussion.

1
Estimation

[GRF] Causal forest

The core estimate — where the causal quantity itself is computed.

What happens here

Fit the forest and produce per-unit CATEs and AIPW scores.

Formula
au(x)=\mathbb{E}\!\left[\,Y(1)-Y(0)\mid X=x\, ight]
The estimator

Causal forest — Honest random forest for heterogeneous treatment effects — CATE for a binary treatment via GRF moment conditions.

Reads from the input data Feeds into #2#3
Key code
cf <- causal_forest(X, Y, W)          # Y.hat, W.hat cross-fit
tau.hat <- predict(cf)$predictions    # OOB CATEs
Discussion on this step (0)
  • No comments on this step yet — be the first.
2
Data prep

Doubly-robust score matrix

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

For K arms (or binary), stack the DR scores into the n × K matrix maq consumes.

Reads from #1 Feeds into #4
Discussion on this step (0)
  • No comments on this step yet — be the first.
3
Data prep

Cost matrix

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Per-unit-per-arm cost (or arm-level cost row); zero-cost arms are allowed as a baseline.

Reads from #1 Feeds into #4
Key code
cost <- matrix(unit_cost, n, K)   # per-unit, per-arm spend
Discussion on this step (0)
  • No comments on this step yet — be the first.
4
Heterogeneity

[GRF] Multi-armed Qini curves (maq)

Heterogeneity — who is affected, and by how much, not just on average.

What happens here

Trace the Pareto frontier of expected gain vs total spend, with bootstrap CIs.

Formula
\max_{\pi}\ \mathbb{E}\!\Big[ extstyle\sum_k\pi_k(X)\, au_k(X)\Big]\ \ ext{s.t.}\ \ \mathbb{E}\!\Big[ extstyle\sum_k\pi_k(X)\,C_k(X)\Big]\le B
The estimator

Multi-armed Qini curves (maq) — Cost-aware Qini curves with K treatment arms and per-unit costs — pick the arm and the budget jointly.

Reads from #2#3 Feeds into #5
Key code
library(maq)
mq <- maq(DR.scores, cost, R = 200)
plot(mq); average_gain(mq, spend = 0.3)
Discussion on this step (0)
  • No comments on this step yet — be the first.
5
Reporting

Pick the budget; report the gain

Reporting — turn the numbers into a figure or table a reader can act on.

What happens here

Read off the spend that hits a planned ROI; report average_gain() with a CI at that operating point.

Reads from #4 Feeds into the final output
Discussion on this step (0)
  • No comments on this step yet — be the first.
3

Output · what you get 5 figures

A Qini curve vs random targeting — value gained at each level of spend.
Fig 1A Qini curve vs random targeting — value gained at each level of spend.
TOC vs Qini: two views of the same prioritisation, one per-unit, one cumulative.
Fig 2TOC vs Qini: two views of the same prioritisation, one per-unit, one cumulative.
A multi-armed Qini — allocating a fixed budget across several competing treatments.
Fig 3A multi-armed Qini — allocating a fixed budget across several competing treatments.
Single- vs multi-armed policy value at matched spend.
Fig 4Single- vs multi-armed policy value at matched spend.
The area between two Qini curves quantifies which policy is better, and by how much.
Fig 5The area between two Qini curves quantifies which policy is better, and by how much.

Figures reproduced from grf — Athey, Tibshirani & Wager — unofficial community showcase; all credit to the original authors.

The GRF 'Qini curves' tutorial. Targeting in the real world has a budget and per-unit costs; the maq sister package turns CATEs into a Pareto frontier of expected-gain vs spend so you can pick the operating point honestly. Unofficial summary.

Discussion (0)

  • No comments yet — start the conversation.