ateCAL: reweight experimental results to match external sample
ateCAL.Rd
Generalization or transportation estimator with method of moments weighting. Imputes counterfactual outcome for each observation i under each treament a as $$Y^a = \omega \frac{A = a}{\pi^a (X)} (Y - \mu^a(X)) + \mu^a(X) $$ Where \(\omega\) is solved for using entropy balancing for balance with target moments.
Arguments
- y
outcome vector [length n]
- a
treatment vector [length n]
- X
covariate matrix [n X k]
- targetMoments
k-vector of target moments (means in overall sample for generalization, means in target sample for transportation
- treatProb
treatment probability, non-null results in no pscore fit
- nuismod
one of c("rlm", "rf") : choose how to fit nuisance functions (cross-fit) for outcome models
- estimator
one of c("CW", "ACW"). Calibration weights (CW), which fit a set of balancing weights that reweights the sample to match target sample moments. ACW augments this with an outcome model (default)
- glmnet_lamchoice
choice of lambda (shrinkage parameter) for regularized linear regressions. Only relevant when nuismod == "rlm"
- glmnet_alpha
in [0, 1], choice of alpha in glmnet. 1 (default) corresponds with L1 regularization (LASSO) and 0 corresponds with L2 regularization (ridge), while intermediate values correspond with a mix of the two (elastic net)
- separateMus
boolean for whether to fit separate outcome models for each treatment group or a single pooled model. The former is recommended and is the default, but a pooled model may be fit when data is scarce / computation is burdensome.
- noi
boolean for printing marginal means and causal contrasts table (it gets returned anyway). On by default.
Value
list containing treatment effects table , nuisance function estimates, and influence function values
Examples
df = selDGP(n = 10000)
id = with(df, s == 1)
X = df$X[id == 1, ]; y = df$y[id == 1]; a = df$a[id == 1]
Xtar = colMeans(df$X[!id, ])
ateCAL(y, a, X, targetMoments = Xtar, estimator = "ACW") %>% summary()
#> parameter est se ci.ll ci.ul pval
#> 1 E{Y(0)} 1.3290194 0.11525310 1.1031233 1.554915 0
#> 2 E{Y(1)} 1.9960402 0.08746187 1.8246150 2.167466 0
#> 3 E{Y(1)-Y(0)} 0.6670209 0.13026080 0.4117097 0.922332 0