A wrapper function for AIPW$new()$fit()$summary()

aipw_wrapper(
  Y,
  A,
  verbose = TRUE,
  W = NULL,
  W.Q = NULL,
  W.g = NULL,
  Q.SL.library,
  g.SL.library,
  k_split = 10,
  g.bound = 0.025,
  stratified_fit = FALSE
)

Arguments

Y

Outcome (binary integer: 0 or 1)

A

Exposure (binary integer: 0 or 1)

verbose

Whether to print the result (logical; Default = FALSE)

W

covariates for both exposure and outcome models (vector, matrix or data.frame). If null, this function will seek for inputs from W.Q and W.g.

W.Q

Only valid when W is null, otherwise it would be replaced by W. Covariates for outcome model (vector, matrix or data.frame).

W.g

Only valid when W is null, otherwise it would be replaced by W. Covariates for exposure model (vector, matrix or data.frame)

Q.SL.library

SuperLearner libraries or sl3 learner object (Lrnr_base) for outcome model

g.SL.library

SuperLearner libraries or sl3 learner object (Lrnr_base) for exposure model

k_split

Number of splitting (integer; range: from 1 to number of observation-1): if k_split=1, no cross-fitting; if k_split>=2, cross-fitting is used (e.g., k_split=10, use 9/10 of the data to estimate and the remaining 1/10 leftover to predict). NOTE: it's recommended to use cross-fitting.

g.bound

Value between [0,1] at which the propensity score should be truncated. Defaults to 0.025.

stratified_fit

An indicator for whether the outcome model is fitted stratified by exposure status in thefit() method. Only when using stratified_fit() to turn on stratified_fit = TRUE, summary outputs average treatment effects among the treated and the controls.

Value

A fitted AIPW object with summarised results

See also

Examples

library(SuperLearner) aipw_sl <- aipw_wrapper(Y=rbinom(100,1,0.5), A=rbinom(100,1,0.5), W.Q=rbinom(100,1,0.5), W.g=rbinom(100,1,0.5), Q.SL.library="SL.mean",g.SL.library="SL.mean", k_split=1,verbose=FALSE)