Skip to contents

Source: test_calibration in the CRAN package grf (grf 2.6.1, R/forest_summary.R), implementing the calibration check of Chernozhukov, Demirer, Duflo and Fernandez-Val (2018), arXiv 1712.04802, in the form Athey and Wager (2019) use. The package source regresses, with no intercept, target = Y - Yhat on (W - What) * mean(tauhat) and (W - What) * (tauhat - mean(tauhat)), with HC3 sandwich SEs and p-values converted to one-sided.

Usage

Htebias(y, D, tau_hat, y_hat = NULL, w_hat = NULL)

Arguments

y

Numeric outcome of length n.

D

Numeric treatment assignment of length n.

tau_hat

Out-of-fold CATE predictions, one per unit: the vector the best linear predictor is calibrated against, not a covariate matrix.

y_hat

Optional out-of-fold predictions of E[Y|X]; defaults to mean(y).

w_hat

Optional out-of-fold propensity scores; defaults to mean(D).

Value

list: coef_mean, coef_differential, se_mean, se_differential, t_mean, t_differential, p_mean, p_differential, n, method.

Details

The coefficient on the mean term tests whether the average treatment effect is right; the coefficient on the differential term is 1 when the CATE estimates carry real signal, and a coefficient far from 1, or a one-sided p-value that fails to reject 0, says the heterogeneity estimates are biased or noise.

HC3 is written out rather than delegated, since sandwich is not a dependency here: \(V = (X primeX)^-1 [sum_i x_i x_i' e_i^2/(1 - h_ii)^2] (X primeX)^-1\), MacKinnon and White (1985), the grf default.

Examples

set.seed(1)
D <- rep(0:1, 30)
tau <- seq(0, 2, length.out = 60)
Htebias(tau * D + rnorm(60), D, tau)$coef_differential
#> [1] 0.9151367