| average_partial_effect {grf} | R Documentation |
Gets estimates of the average partial effect, in particular the (conditional) average treatment effect (target.sample = all): 1/n sum_i = 1^n Cov[Wi, Yi | X = Xi] / Var[Wi | X = Xi]. Note that for a binary unconfounded treatment, the average partial effect matches the average treatment effect.
average_partial_effect(forest, calibrate.weights = TRUE, subset = NULL, num.trees.for.variance = 500)
forest |
The trained forest. |
calibrate.weights |
Whether to force debiasing weights to match expected moments for 1, W, W.hat, and 1/Var[W|X]. |
subset |
Specifies a subset of the training examples over which we estimate the ATE. WARNING: For valid statistical performance, the subset should be defined only using features Xi, not using the treatment Wi or the outcome Yi. |
num.trees.for.variance |
Number of trees used to estimate Var[Wi | Xi = x]. |
If clusters are specified, then each cluster gets equal weight. For example, if there are 10 clusters with 1 unit each and per-cluster APE = 1, and there are 10 clusters with 19 units each and per-cluster APE = 0, then the overall APE is 0.5 (not 0.05).
An estimate of the average partial effect, along with standard error.
## Not run: n = 2000; p = 10 X = matrix(rnorm(n*p), n, p) W = rbinom(n, 1, 1/(1 + exp(-X[,2]))) + rnorm(n) Y = pmax(X[,1], 0) * W + X[,2] + pmin(X[,3], 0) + rnorm(n) tau.forest = causal_forest(X, Y, W) tau.hat = predict(tau.forest) average_partial_effect(tau.forest) average_partial_effect(tau.forest, subset = X[,1] > 0) ## End(Not run)