Skip to contents

Unified workflow for two-period, two-group ATT estimation. The function estimates generalized propensity scores and outcome regressions with local-polynomial smoothing, cross-fitted DML-style learners, or parametric first steps, then plugs the nuisance predictions into drdid_nonstationary().

Usage

att_estimate(
  dp,
  nuisance_method = c("loo", "dml", "parametric"),
  ps_cv_method = "cv.ml",
  lp_type = "logit",
  list_control_ps = list(n_start = 1, ps_min = 1e-05, cv_type = "loocv", lp_order = 1,
    bw_seed = NULL, bw_upper_cont = "adaptive", n_threads = 0, rcv_train_frac = 0.5),
  list_control_or = list(n_start = 2, bw_constrained = FALSE, cv_type = "loocv", or_order
    = 1, bw_seed = NULL, bw_upper_cont = "adaptive", rcv_train_frac = 0.5),
  dml_backend = c("custom", "mlr3"),
  parametric_method = c("improved", "base"),
  K = 2,
  seed = 123,
  fold_id = NULL,
  ps_learner = NULL,
  or_learner = NULL,
  ps_learner_param = list(),
  or_learner_param = list(),
  tune_ps = FALSE,
  tune_or = FALSE,
  ps_search_space = NULL,
  or_search_space = NULL,
  ps_tuner = "random_search",
  or_tuner = "random_search",
  ps_term_evals = 20L,
  or_term_evals = 20L,
  ps_inner_folds = 3L,
  or_inner_folds = 3L,
  ps_measure = NULL,
  or_measure = NULL,
  stabilized = TRUE,
  i.weights = NULL,
  boot = FALSE,
  nboot = NULL,
  boot_type = c("mammen", "normal", "bayes", "wild"),
  inffunc = TRUE,
  ...
)

Arguments

dp

Data list containing y, d, post, dpost, covariates, and dim_covariates. For user-supplied data, construct this object with make_did_dp().

nuisance_method

Either "loo" for local-polynomial nuisance estimation, "dml" for cross-fitted nuisance estimation, or "parametric" for fixed-dimensional parametric first steps.

ps_cv_method

Bandwidth CV loss for the GPS model.

lp_type

Local-polynomial type for the GPS model.

list_control_ps

Control list for locpol_ps_fit().

list_control_or

Control list for locpol_or_fit().

dml_backend

DML nuisance backend: "custom" or "mlr3". The default custom backend uses the built-in compdid_cell_ps() and compdid_cell_or() learners.

parametric_method

Parametric nuisance method. "improved" fits the pairwise-IPT odds-ratio and weighted least-squares first steps; "base" fits multinomial-logit generalized propensity scores and OLS outcome regressions.

K

Number of folds for cross-fitting.

seed

Random seed for fold assignment when fold_id is NULL.

fold_id

Optional integer vector of length n with values in 1:K.

ps_learner

For dml_backend = "mlr3", a learner id or learner object for multiclass classification. For dml_backend = "custom", a function (dp_train, dp_test, ...) -> n_test x 4. If NULL, defaults to compdid_cell_ps() for the custom backend and "classif.multinom" for the mlr3 backend.

or_learner

For dml_backend = "mlr3", a learner id or learner object for regression. For dml_backend = "custom", a function (dp_train, dp_test, ...) -> n_test x 4. If NULL, defaults to compdid_cell_or() for the custom backend and "regr.lm" for the mlr3 backend.

ps_learner_param, or_learner_param

Optional named lists of mlr3 parameter values.

tune_ps, tune_or

Logical; if TRUE, tune the corresponding learner inside each training fold.

ps_search_space, or_search_space

paradox::ParamSet search spaces used when tuning is enabled.

ps_tuner, or_tuner

Tuner object or tuner id string.

ps_term_evals, or_term_evals

Integer tuning budgets.

ps_inner_folds, or_inner_folds

Integer inner-CV folds used for tuning.

ps_measure, or_measure

Optional mlr3 measure object or id.

stabilized

Logical; passed to drdid_nonstationary().

i.weights

Optional weights. Non-unit sampling weights are not yet supported by the current doubly robust second stage.

boot

Logical; if TRUE, use bootstrap-based inference.

nboot

Number of bootstrap replications if boot = TRUE.

boot_type

Multiplier-bootstrap type.

inffunc

Logical; return influence function from the doubly robust stage.

...

Extra arguments forwarded to nuisance fitting calls.

Value

A list with method, backend, nuisance, and att.