Skip to contents

Y = theta D + g(X) + eps, D = m(X) + nu, estimated by theta = (Dtilde'Dtilde)^-1 Dtilde'Ytilde with both residuals CROSS-FITTED: each observation's nuisance prediction comes from a model fitted without it.

Usage

morie_caus_dml_partial_lin(y, D, X, n_folds = 5, learner = NULL, seed = 0)

Arguments

y

outcome.

D

treatment.

X

controls.

n_folds

cross-fitting folds, at least 2.

learner

optional function(Xtr, ytr) returning a predict function; a ridge fit when NULL.

seed

fold-assignment seed.

Value

list: theta, se, ci, y_residual, d_residual, theta_in_sample, cross_fitted, n_folds, first_stage_r2, n, p, method.

Details

Two ingredients, neither optional. Residualising BOTH Y and D on X makes the score Neyman-orthogonal, so first-order errors in the nuisance estimates do not contaminate theta; residualising only Y and regressing on raw D is not orthogonal and the bias returns. And cross-fitting removes a regularisation bias that otherwise does not vanish at root-n. theta_in_sample is computed alongside precisely so the gap is visible.

References

Chernozhukov, Chetverikov, Demirer, Duflo, Hansen, Newey and Robins (2018), Econometrics Journal 21:C1-C68.

Examples

set.seed(1)
X <- matrix(stats::rnorm(600), 200)
D <- X[, 1] + stats::rnorm(200)
morie_caus_dml_partial_lin(1.5 * D + X[, 1], D, X, n_folds = 3)$theta
#> [1] 1.499996