Skip to contents

Native locally efficient doubly robust DiD estimator for the 2x2 repeated-cross-section setting (the estimand of DRDID::drdid_rc, reproduced to machine precision incl. the influence function; see tests/cross/). Combines a logistic propensity-score model with linear outcome regressions and is consistent if either model is correctly specified.

Usage

morie_did_doubly_robust(
  data,
  outcome,
  treatment,
  post,
  covariates,
  ps_model = "logistic",
  or_model = "linear",
  cluster = NULL,
  n_bootstrap = 200L,
  seed = 42L,
  alpha = 0.05,
  se_convention = "reference"
)

Arguments

data

A data frame containing the outcome, treatment, post and any covariate columns.

outcome

Name of the outcome column.

treatment

Name of the binary (0/1) treatment-group column.

post

Name of the binary (0/1) post-period column.

covariates

Optional character vector of covariate column names.

ps_model

Unused; retained for back-compat. A logistic propensity-score model is fitted internally.

or_model

Unused; retained for back-compat. Linear outcome models are fitted internally.

cluster

Optional cluster ID column for CR1 standard errors.

n_bootstrap

Number of multiplier-bootstrap replications for the standard error (0 = analytic influence-function SE).

seed

RNG seed for the multiplier bootstrap.

alpha

Significance level for confidence intervals (default 0.05).

se_convention

For the analytic SE: "reference" (default) matches DRDID::drdid_rc's population-sd convention exactly; "bessel" keeps Bessel's correction (sd(IF)/sqrt(n)). Asymptotically equivalent.

Value

A result list; see morie_did_2x2.

References

Sant'Anna, P. H. C., & Zhao, J. (2020). Doubly robust difference-in-differences estimators. Journal of Econometrics, 219(1), 101–122.

Examples

set.seed(23)
n <- 300
treat <- rep(c(0L, 1L), each = n / 2)
df <- data.frame(unit = rep(1:n, 2), treat = rep(treat, 2),
                 post = rep(c(0L, 1L), each = n), x = rnorm(2 * n))
df$y <- 0.5 * df$post + 3 * df$treat * df$post + rnorm(2 * n, sd = 0.4)
res <- morie_did_doubly_robust(df, outcome = "y", treatment = "treat",
                               post = "post", covariates = "x",
                               n_bootstrap = 50L, seed = 1L)
res$estimate
#> [1] 2.9401