Doubly robust LATE / LATT with a binary instrument
drlate.RdFormula front-end mirroring the Stata drlate three-equation syntax. The
outcome, treatment and instrument arguments are formulas whose LHS give
the outcome \(Y\), treatment \(W\) and (binary) instrument \(Z\), and
whose RHS give the covariates for the outcome model, treatment model and
instrument propensity-score model respectively.
Usage
drlate(
outcome,
treatment,
instrument,
data,
method = c("ipwra", "ipw", "aipw", "ra"),
estimand = c("late", "latt"),
ps = c("logit", "cbps", "ipt"),
outcome_family = c("linear", "logit", "poisson"),
treatment_family = c("logit", "linear", "poisson"),
normalize = TRUE,
vce = c("robust", "cluster", "bootstrap"),
cluster = NULL,
boot_reps = 400L,
boot_seed = NULL,
weights = NULL,
pstolerance = 1e-05,
osample = FALSE
)Arguments
- outcome
Outcome equation, e.g.
y ~ x1 + x2.- treatment
Treatment equation, e.g.
d ~ x1 + x2.- instrument
Instrument propensity-score equation, e.g.
z ~ x1 + x2.- data
A data frame.
- method
Estimator:
"ipwra"(default),"ipw","aipw", or"ra".- estimand
"late"(default) or"latt"(LATE on the treated).- ps
Instrument PS method:
"logit"(default),"cbps", or"ipt".- outcome_family
Outcome QMLE family:
"linear"(default),"logit","poisson".- treatment_family
Treatment QMLE family:
"logit"(default),"linear","poisson".- normalize
Logical; normalized vs unnormalized IPW/AIPW moments. Ignored (normalized by construction) for
"ipwra"and"ra".- vce
Variance type:
"robust"(default),"cluster", or"bootstrap"."cluster"requires aclustervariable;"bootstrap"usesboot_repsnonparametric resamples (seeboot_reps/boot_seed).- cluster
Optional cluster variable: a column name in
dataor a length-n vector. Required whenvce = "cluster".- boot_reps
Number of nonparametric bootstrap resamples when
vce = "bootstrap". Default 400.- boot_seed
Optional integer RNG seed for
vce = "bootstrap"reproducibility.- weights
Optional pweights: a column name in
dataor a length-n vector. Defaults to all ones.- pstolerance
Overlap tolerance; fitted instrument PS must lie in
[pstolerance, 1 - pstolerance]. Default1e-5.- osample
Logical; if
TRUE, instead of erroring on overlap violations the returned object carries anosamplelogical vector flagging them.
Value
An object of class "drlate": a list with coef (named
late/num/denom), vcov (3x3), nobs, method, estimand, ps,
outcome_family, treatment_family, normalize, vce, call,
dmeanz0/dmeanz1 (sample mean of the treatment when Z=0 and when Z=1),
and (when osample=TRUE) osample.
References
Słoczyński, T., Uysal, S. D., and Wooldridge, J. M. (2022). Doubly Robust Estimation of Local Average Treatment Effects Using Inverse Probability Weighted Regression Adjustment. arXiv:2208.01300. doi:10.48550/arXiv.2208.01300
Examples
# Small simulated instrumental-variables example (runs in <1s).
set.seed(1)
n <- 200
x <- rnorm(n)
z <- rbinom(n, 1, plogis(0.3 * x)) # binary instrument
d <- rbinom(n, 1, plogis(-0.2 + 0.8 * z + 0.3 * x)) # treatment
y <- 1 + 0.5 * d + 0.4 * x + rnorm(n) # outcome
dat <- data.frame(y, d, z, x)
# Default: doubly robust IPWRA LATE (logit PS, linear outcome, logit treatment)
fit <- drlate(y ~ x, d ~ x, z ~ x, data = dat)
fit
#>
#> Local average treatment effect Number of obs = 200
#> Estimator : IPWRA
#> Outcome model : linear
#> Treatment model : logit
#> Instrument model: logit (MLE)
#>
#> Estimate Std. Err. z P>|z| [95% Conf. Interval]
#> late 0.7142 0.6675 1.0700 0.2846 -0.5940 2.0225
#> num 0.1627 0.1552 1.0479 0.2947 -0.1416 0.4669
#> denom 0.2277 0.0659 3.4545 0.0006 0.0985 0.3569
coef(fit)
#> late num denom
#> 0.7142439 0.1626520 0.2277261
# AIPW with an inverse-probability-tilting instrument propensity score
drlate(y ~ x, d ~ x, z ~ x, data = dat, method = "aipw", ps = "ipt")
#> IPT weights are normalized; setting normalize = FALSE
#>
#> Local average treatment effect Number of obs = 200
#> Estimator : AIPW (normalized)
#> Outcome model : linear
#> Treatment model : logit
#> Instrument model: logit (IPT)
#>
#> Estimate Std. Err. z P>|z| [95% Conf. Interval]
#> late 0.7142 0.6675 1.0701 0.2846 -0.5940 2.0224
#> num 0.1627 0.1552 1.0479 0.2947 -0.1416 0.4669
#> denom 0.2277 0.0659 3.4548 0.0006 0.0985 0.3569
# LATE on the treated (LATT)
drlate(y ~ x, d ~ x, z ~ x, data = dat, estimand = "latt")
#>
#> Local average treatment effect on the treated Number of obs = 200
#> Estimator : IPWRA
#> Outcome model : linear
#> Treatment model : logit
#> Instrument model: logit (MLE)
#>
#> Estimate Std. Err. z P>|z| [95% Conf. Interval]
#> late 0.7184 0.6646 1.0809 0.2798 -0.5843 2.0210
#> num 0.1636 0.1546 1.0579 0.2901 -0.1395 0.4666
#> denom 0.2277 0.0660 3.4500 0.0006 0.0983 0.3571