drtmle {drtmle}  R Documentation 
TMLE estimate of the average treatment effect with doublyrobust inference
drtmle(Y, A, W, DeltaA = as.numeric(!is.na(A)),
DeltaY = as.numeric(!is.na(Y)), a_0 = unique(A[!is.na(A)]), family = if
(all(Y %in% c(0, 1))) { stats::binomial() } else {
stats::gaussian() }, stratify = FALSE, SL_Q = NULL, SL_g = NULL,
SL_Qr = NULL, SL_gr = NULL, n_SL = 1, avg_over = "drtmle",
se_cv = "none", se_cvFolds = ifelse(se_cv == "partial", 10, 1),
targeted_se = se_cv != "partial", glm_Q = NULL, glm_g = NULL,
glm_Qr = NULL, glm_gr = NULL, adapt_g = FALSE, guard = c("Q", "g"),
reduction = "univariate", returnModels = FALSE, returnNuisance = TRUE,
cvFolds = 1, maxIter = 3, tolIC = 1/length(Y), tolg = 0.01,
verbose = FALSE, Qsteps = 2, Qn = NULL, gn = NULL,
use_future = FALSE, ...)
Y 
A 
A 
A 
W 
A 
DeltaA 
A 
DeltaY 
A 
a_0 
A 
family 
A 
stratify 
A 
SL_Q 
A vector of characters or a list describing the Super Learner
library to be used for the outcome regression. See

SL_g 
A vector of characters describing the super learner library to be
used for each of the propensity score regressions ( 
SL_Qr 
A vector of characters or a list describing the Super Learner library to be used for the reduceddimension outcome regression. 
SL_gr 
A vector of characters or a list describing the Super Learner library to be used for the reduceddimension propensity score. 
n_SL 
Number of repeated Super Learners to run (default 1) for the each nuisance parameter. Repeat Super Learners more times to obtain more stable inference. 
avg_over 
If multiple Super Learners are run, on which scale should the
results be aggregated. Options include: 
se_cv 
Should crossvalidated nuisance parameter estimates be used
for computing standard errors?
Options are 
se_cvFolds 
If crossvalidated nuisance parameter estimates are used
to compute standard errors, how many folds should be used in this computation.
If 
targeted_se 
A boolean indicating whether the targeted nuisance
parameters should be used in standard error computation or the initial
estimators. If 
glm_Q 
A character describing a formula to be used in the call to

glm_g 
A list of characters describing the formulas to be used
for each of the propensity score regressions ( 
glm_Qr 
A character describing a formula to be used in the call to

glm_gr 
A character describing a formula to be used in the call to

adapt_g 
A boolean indicating whether the propensity score should be
outcome adaptive. If 
guard 
A character vector indicating what pattern of misspecifications
to guard against. If 
reduction 
A character equal to 
returnModels 
A boolean indicating whether to return model fits for the outcome regression, propensity score, and reduceddimension regressions. 
returnNuisance 
A boolean indicating whether to return the estimated
nuisance regressions evaluated on the observed data. Defaults to 
cvFolds 
A numeric equal to the number of folds to be used in
crossvalidated fitting of nuisance parameters. If 
maxIter 
A numeric that sets the maximum number of iterations the TMLE can perform in its fluctuation step. 
tolIC 
A numeric that defines the stopping criteria based on the empirical mean of the influence function. 
tolg 
A numeric indicating the minimum value for estimates of the propensity score. 
verbose 
A boolean indicating whether to print status updates. 
Qsteps 
A numeric equal to 1 or 2 indicating whether the fluctuation
submodel for the outcome regression should be fit using a single
minimization ( 
Qn 
An optional list of outcome regression estimates. If specified, the
function will ignore the nuisance parameter estimation specified by

gn 
An optional list of propensity score estimates. If specified, the
function will ignore the nuisance parameter estimation specified by

use_future 
Boolean indicating whether to use 
... 
Other options (not currently used). 
An object of class "drtmle"
.
drtmle
A list
of doublyrobust point estimates and
a doublyrobust covariance matrix
nuisance_drtmle
A list
of the final TMLE estimates of
the outcome regression ($QnStar
), propensity score
($gnStar
), and reduceddimension regressions ($QrnStar
,
$grnStar
) evaluated at the observed data values.
ic_drtmle
A list
of the empirical mean of the efficient
influence function ($eif
) and the extra pieces of the influence
function resulting from misspecification. All should be smaller than
tolIC
(unless maxIter
was reached first). Also includes
a matrix of the influence function values at the estimated nuisance
parameters evaluated at the observed data.
aiptw_c
A list
of doublyrobust point estimates and
a nondoublyrobust covariance matrix. Theory does not guarantee
performance of inference for these estimators, but simulation studies
showed they often perform adequately.
nuisance_aiptw
A list
of the initial estimates of the
outcome regression, propensity score, and reduceddimension
regressions evaluated at the observed data values.
tmle
A list
of doublyrobust point estimates and
nondoublyrobust covariance for the standard TMLE estimator.
aiptw
A list
of doublyrobust point estimates and
nondoublyrobust covariance matrix for the standard AIPTW estimator.
gcomp
A list
of nondoublyrobust point estimates and
nondoublyrobust covariance matrix for the standard Gcomputation
estimator. If super learner is used there is no guarantee of correct
inference for this estimator.
QnMod
The fitted object for the outcome regression. Returns
NULL
if returnModels = FALSE
.
gnMod
The fitted object for the propensity score. Returns
NULL
if returnModels = FALSE
.
QrnMod
The fitted object for the reduceddimension regression
that guards against misspecification of the outcome regression.
Returns NULL
if returnModels = FALSE
.
grnMod
The fitted object for the reduceddimension regression
that guards against misspecification of the propensity score. Returns
NULL
if returnModels = FALSE
.
a_0
The treatment levels that were requested for computation of covariateadjusted means.
# 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))
# A quick example of drtmle:
# We note that more flexible super learner libraries
# are available, and that we recommend the user use more flexible
# libraries for SL_Qr and SL_gr for general use.
fit1 < drtmle(
W = W, A = A, Y = Y, a_0 = c(1, 0),
family = binomial(),
stratify = FALSE,
SL_Q = c("SL.glm", "SL.mean", "SL.glm.interaction"),
SL_g = c("SL.glm", "SL.mean", "SL.glm.interaction"),
SL_Qr = "SL.glm",
SL_gr = "SL.glm", maxIter = 1
)