Compute asymptotically linear IPTW estimators with super learning for the propensity score
adaptive_iptw(W, A, Y, DeltaY = as.numeric(!is.na(Y)),
DeltaA = as.numeric(!is.na(A)), stratify = FALSE, family = if (all(Y
%in% c(0, 1))) { stats::binomial() } else { stats::gaussian() },
a_0 = unique(A[!is.na(A)]), SL_g = NULL, glm_g = NULL, SL_Qr = NULL,
glm_Qr = NULL, returnModels = TRUE, verbose = FALSE, maxIter = 2,
tolIC = 1/length(Y), tolg = 0.01, cvFolds = 1, gn = NULL, ...)An object of class "adaptive_iptw".
iptw_tmleA list of point estimates and
covariance matrix for the IPTW estimator based on a targeted
propensity score.
iptw_tmle_nuisanceA list of the final TMLE estimates
of the propensity score ($gnStar) and reduced-dimension
regression ($QrnStar) evaluated at the observed data values.
iptw_osA list of point estimates and covariance matrix
for the one-step correct IPTW estimator.
iptw_os_nuisanceA list of the initial estimates of the
propensity score and reduced-dimension regression evaluated at the
observed data values.
iptwA list of point estimates for the standard IPTW
estimator. No estimate of the covariance matrix is provided because
theory does not support asymptotic Normality of the IPTW estimator if
super learning is used to estimate the propensity score.
gnModThe fitted object for the propensity score. Returns
NULL if returnModels = FALSE.
QrnModThe fitted object for the reduced-dimension regression
that guards against misspecification of the outcome regression.
Returns NULL if returnModels = FALSE.
a_0The treatment levels that were requested for computation of covariate-adjusted means.
callThe call to adaptive_iptw.
A data.frame of named covariates
A numeric vector of binary treatment assignment (assumed to
be equal to 0 or 1)
A numeric numeric of continuous or binary outcomes.
A numeric indicator of missing outcome (assumed to be
equal to 0 if missing 1 if observed)
A numeric indicator of missing treatment (assumed to be
equal to 0 if missing 1 if observed)
A logical indicating whether to estimate the missing
outcome regression separately for observations with different levels of
A (if TRUE) or to pool across A (if FALSE).
A family object equal to either binomial() or
gaussian(), to be passed to the SuperLearner or glm
function.
A vector of numeric treatment values at which to return
marginal mean estimates.
A vector of characters describing the super learner library to be
used for each of the propensity score regressions (DeltaA, A,
and DeltaY). To use the same library for each of the regressions (or
if there is no missing data in A nor Y), a single library may
be input. See link{SuperLearner::SuperLearner} for details on how
super learner libraries can be specified.
A list of characters describing the formulas to be used
for each of the propensity score regressions (DeltaA, A, and
DeltaY). To use the same formula for each of the regressions (or if
there is no missing data in A nor Y), a single character
formula may be input.
A vector of characters or a list describing the Super Learner library to be used for the reduced-dimension outcome regression.
A character describing a formula to be used in the call to
glm for reduced-dimension outcome regression. Ignored if
SL_Qr!=NULL. The formula should use the variable name 'gn'.
A logical indicating whether to return model fits for the propensity score and reduced-dimension regressions.
A logical indicating whether to print status updates.
A numeric that sets the maximum number of iterations the TMLE can perform in its fluctuation step.
A numeric that defines the stopping criteria based on the empirical mean of the influence function.
A numeric indicating the minimum value for estimates of the propensity score.
A numeric equal to the number of folds to be used in
cross-validated fitting of nuisance parameters. If cvFolds = 1, no
cross-validation is used.
An optional list of propensity score estimates. If specified, the
function will ignore the nuisance parameter estimation specified by
SL_g and glm_g. The entries in the list should correspond to
the propensity for the observed values of W, with order determined by
the input to a_0 (e.g., if a_0 = c(0,1) then gn[[1]]
should be propensity of A = 0 and gn[[2]] should be propensity
of A = 1).
Other options (not currently used).
# load super learner
library(SuperLearner)
# simulate data
set.seed(123456)
n <- 100
W <- data.frame(W1 = runif(n), W2 = rnorm(n))
A <- rbinom(n, 1, plogis(W$W1 - W$W2))
Y <- rbinom(n, 1, plogis(W$W1 * W$W2 * A))
# fit iptw with maxIter = 1 to run fast
# \donttest{
fit1 <- adaptive_iptw(
W = W, A = A, Y = Y, a_0 = c(1, 0),
SL_g = c("SL.glm", "SL.mean", "SL.step"),
SL_Qr = "SL.npreg", maxIter = 1
)
# }
Run the code above in your browser using DataLab