Description Usage Arguments Details Value Examples
Estimate Counterfactual Mean Under Stochastic Shift in Exposure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  txshift(
W,
A,
Y,
C = rep(1, length(Y)),
V = NULL,
delta = 0,
estimator = c("tmle", "onestep"),
fluctuation = c("standard", "weighted"),
max_iter = 10,
ipcw_fit_args = list(fit_type = c("glm", "sl", "external"), sl_learners = NULL),
g_fit_args = list(fit_type = c("hal", "sl", "external"), n_bins = c(10, 25),
grid_type = c("equal_range", "equal_range"), lambda_seq = exp(seq(1, 13, length =
300)), use_future = FALSE, sl_learners_density = NULL),
Q_fit_args = list(fit_type = c("glm", "sl", "external"), glm_formula = "Y ~ .",
sl_learners = NULL),
eif_reg_type = c("hal", "glm"),
ipcw_efficiency = TRUE,
ipcw_fit_ext = NULL,
gn_fit_ext = NULL,
Qn_fit_ext = NULL
)

W 
A 
A 
A 
Y 
A 
C 
A 
V 
The covariates that are used in determining the sampling procedure
that gives rise to censoring. The default is 
delta 
A 
estimator 
The type of estimator to be fit, either 
fluctuation 
The method to be used in the submodel fluctuation step (targeting step) to compute the TML estimator. The choices are "standard" and "weighted" for where to place the auxiliary covariate in the logistic tilting regression. 
max_iter 
A 
ipcw_fit_args 
A 
g_fit_args 
A 
Q_fit_args 
A 
eif_reg_type 
Whether a flexible nonparametric function ought to be
used in the dimensionreduced nuisance regression of the targeting step for
the censored data case. By default, the method used is a nonparametric
regression based on the Highly Adaptive Lasso (from hal9001). Set
this to 
ipcw_efficiency 
Whether to invoke an augmentation of the IPCWTMLE
procedure that performs an iterative process to ensure efficiency of the
resulting estimate. The default is 
ipcw_fit_ext 
The results of an external fitting procedure used to
estimate the twophase censoring mechanism, to be used in constructing the
inverse probability of censoring weighted TML or onestep estimator. The
input provided must match the output of 
gn_fit_ext 
The results of an external fitting procedure used to
estimate the exposure mechanism (generalized propensity score), to be used
in constructing the TML or onestep estimator. The input provided must
match the output of 
Qn_fit_ext 
The results of an external fitting procedure used to
estimate the outcome mechanism, to be used in constructing the TML or
onestep estimator. The input provided must match the output of

Construct a onestep estimate or targeted minimum loss estimate of the counterfactual mean under a modified treatment policy, automatically making adjustments for twophase sampling when a censoring indicator is included. Ensemble machine learning may be used to construct the initial estimates of nuisance functions using sl3.
S3 object of class txshift
containing the results of the
procedure to compute a TML or onestep estimate of the counterfactual mean
under a modified treatment policy that shifts a continuousvalued exposure
by a scalar amount delta
. These estimates can be augmented to be
consistent and efficient when twophase sampling is performed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  set.seed(429153)
n_obs < 100
W < replicate(2, rbinom(n_obs, 1, 0.5))
A < rnorm(n_obs, mean = 2 * W, sd = 1)
Y < rbinom(n_obs, 1, plogis(A + W + rnorm(n_obs, mean = 0, sd = 1)))
C < rbinom(n_obs, 1, plogis(W + Y)) # twophase sampling
# construct a TML estimate (set estimator = "onestep" for the onestep)
tmle < txshift(
W = W, A = A, Y = Y, delta = 0.5,
estimator = "tmle",
g_fit_args = list(
fit_type = "hal", n_bins = 5,
grid_type = "equal_range",
lambda_seq = exp(1:9)
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
)
)
# construct a TML estimate under twophase sampling
ipcwtmle < txshift(
W = W, A = A, Y = Y, delta = 0.5,
C = C, V = c("W", "Y"),
estimator = "tmle", max_iter = 5,
ipcw_fit_args = list(fit_type = "glm"),
g_fit_args = list(
fit_type = "hal", n_bins = 5,
grid_type = "equal_range",
lambda_seq = exp(1:9)
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
),
eif_reg_type = "glm"
)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.