Skip to contents

Fits the propensity score g(X) = P(A = 1 | X) and the outcome regression Q_a(X) = E[Y | A = a, X] with a shared Super Learner library, under one of three fitting schemes. Every scheme returns the same object shape, so the downstream estimators (dr_aipw(), dr_tmle(), ...) are identical regardless of how the nuisances were fit.

Usage

dr_nuisance(
  Y,
  A,
  X,
  strategy = c("full", "crossfit", "double"),
  V = 5L,
  Vd = 3L,
  SL.library = default_dr_library,
  family_y = stats::gaussian(),
  gbound = c(0.025, 0.975),
  seed = 1L
)

Arguments

Y

Numeric outcome vector.

A

Binary treatment vector (0/1).

X

Covariates (data frame or matrix).

strategy

Nuisance-fitting scheme: "full" (in-sample, classic AIPW/TMLE), "crossfit" (out-of-fold, DML / CV-TMLE), or "double" (double cross-fit, DC-AIPW / DC-TMLE).

V

Number of folds for "crossfit".

Vd

Number of folds for "double".

SL.library

Super Learner library shared by g and Q (default default_dr_library).

family_y

Outcome family: stats::gaussian() (continuous) or stats::binomial() (binary).

gbound

Truncation bounds for the estimated propensity.

seed

RNG seed for fold construction.

Value

A list with pi (bounded propensity), Q1, Q0, QA, and, for the cross-fit schemes, the fold assignment.

Examples

if (FALSE) { # \dontrun{
d  <- dr_nhefs()
nu <- dr_nuisance(d$Y, d$A, d$X, strategy = "crossfit")
dr_aipw(d$Y, d$A, nu)   # = DML
} # }