
Causal effect estimators: IPW regression, g-computation, 2SLS, PLIV, sequential matching, SNFTM
Source:R/CausalEstimators.R
Ate.RdR arm of morie.fn.ate, g_comp, late, pliv,
prsmtd and snmcox.
Usage
Ate(data, outcome, treatment, weights_col)
GComp(data, treatment, outcome, covariates, outcome_model = "linear")
Late(
data,
treatment,
outcome,
instrument,
covariates = NULL,
se_type = "homoskedastic"
)
Pliv(
data,
treatment,
outcome,
instrument,
covariates,
n_folds = 5,
random_state = 42
)
Prsmtd(A, H)Arguments
- data
A data frame (or list of columns).
- outcome, treatment, instrument
Column names.
- weights_col
Column of analytic weights.
- covariates
Covariate column names.
- outcome_model
"linear"or"logistic".- se_type
"homoskedastic"or"robust"(HC0).- n_folds
Cross-fitting folds.
- random_state
Philox seed of the fold assignment.
- A, H
Treatment-initiation indicators and covariate, n by T matrices (or vectors).
Details
Ate: weighted least squares of the outcome on \((1, T)\); the
treatment coefficient is the Hajek IPW contrast, with the HC3 sandwich of
the weighted fit as its standard error.
GComp: g-computation. An outcome model \(E[Y | T, X]\) (least
squares, or unpenalised logistic regression by Newton's method) is fitted
and the ATE is the mean of \(\hat Y(1) - \hat Y(0)\); the standard error is
the standard deviation of 500 bootstrap replicates (replicate \(b\)
resamples rows from Philox stream \(b\) of seed 42; single-arm resamples
are skipped), the interval their type-7 2.5\
Late: two-stage least squares of \(Y\) on \((1, W, T)\) with
instruments \((1, W, Z)\); homoskedastic or HC0 standard error and the
first-stage F statistic of the excluded instrument.
Pliv: partially linear IV by double machine learning. Ridge
nuisances (penalty chosen from 0.1, 1, 10 by leave-one-out PRESS) are
cross-fitted over folds dealt from the Philox order of seed
random_state; \(\theta = \sum w u / \sum w v\) with the
partialling-out score.
Prsmtd: sequential risk-set propensity matching. In each period a
logistic propensity of initiation on the current covariate is fitted in the
risk set, and initiators (in decreasing propensity) take the nearest unused
not-yet-treated control.
References
Hernan, M. A. and Robins, J. M. (2020). Causal Inference: What If. Chapman & Hall/CRC.
MacKinnon, J. G. and White, H. (1985). Some heteroskedasticity-consistent covariance matrix estimators with improved finite sample properties. Journal of Econometrics 29(3), 305-325.
Robins, J. M. (1986). A new approach to causal inference in mortality studies with a sustained exposure period. Mathematical Modelling 7, 1393-1512.
Imbens, G. W. and Angrist, J. D. (1994). Identification and estimation of local average treatment effects. Econometrica 62(2), 467-475.
Chernozhukov, V. et al. (2018). Double/debiased machine learning for treatment and structural parameters. Econometrics Journal 21(1), C1-C68.
Lu, B. (2005). Propensity score matching with time-dependent covariates. Biometrics 61(3), 721-728.
Robins, J. M. (1992). Estimation of the time-dependent accelerated failure time model in the presence of confounding factors. Biometrika 79(2), 321-334.
Examples
d <- data.frame(
y = c(1, 2.2, 1.7, 3.1, 2.8, 3.9),
t = c(0, 0, 0, 1, 1, 1),
w = c(1.2, 2, 1.5, 1.1, 3, 1.4)
)
Ate(d, "y", "t", "w")
#> $ate
#> [1] 1.405957
#>
#> $se
#> [1] 0.6454726
#>
iv <- list(z = c(0, 0, 0, 0, 1, 1, 1, 1), t = c(0, 0, 1, 0, 1, 1, 0, 1),
y = c(1, 1.4, 3.1, 0.8, 3.3, 2.9, 1.2, 3.6))
Late(iv, "t", "y", "z")$late
#> [1] 2.35