txshift {txshift} | R Documentation |
Efficient Estimate of Counterfactual Mean of Stochastic Shift Intervention
Description
Efficient Estimate of Counterfactual Mean of Stochastic Shift Intervention
Usage
txshift(
W,
A,
C_cens = rep(1, length(A)),
Y,
C_samp = rep(1, length(Y)),
V = NULL,
delta = 0,
estimator = c("tmle", "onestep"),
fluctuation = c("standard", "weighted"),
max_iter = 10,
samp_fit_args = list(fit_type = c("glm", "sl", "external"), sl_learners = NULL),
g_exp_fit_args = list(fit_type = c("hal", "sl", "external"), lambda_seq = exp(seq(-1,
-13, length = 300)), sl_learners_density = NULL),
g_cens_fit_args = list(fit_type = c("glm", "sl", "external"), glm_formula =
"C_cens ~ .^2", sl_learners = NULL),
Q_fit_args = list(fit_type = c("glm", "sl", "external"), glm_formula = "Y ~ .^2",
sl_learners = NULL),
eif_reg_type = c("hal", "glm"),
ipcw_efficiency = TRUE,
samp_fit_ext = NULL,
gn_exp_fit_ext = NULL,
gn_cens_fit_ext = NULL,
Qn_fit_ext = NULL
)
Arguments
W |
A |
A |
A |
C_cens |
A |
Y |
A |
C_samp |
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 |
samp_fit_args |
A |
g_exp_fit_args |
A |
g_cens_fit_args |
A |
Q_fit_args |
A |
eif_reg_type |
Whether a flexible nonparametric function ought to be
used in the dimension-reduced 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 use an augmented inverse probability of
censoring weighted EIF estimating equation to ensure efficiency of the
resultant estimate. The default is |
samp_fit_ext |
The results of an external fitting procedure used to
estimate the two-phase sampling mechanism, to be used in constructing the
inverse probability of censoring weighted TML or one-step estimator. The
input provided must match the output of |
gn_exp_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 one-step estimator. The input provided must
match the output of |
gn_cens_fit_ext |
The results of an external fitting procedure used to
estimate the censoring mechanism (propensity score for missingness), to be
used in constructing the TML or one-step 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
one-step estimator. The input provided must match the output of
|
Details
Construct a one-step estimate or targeted minimum loss estimate of the counterfactual mean under a modified treatment policy, automatically making adjustments for two-phase sampling when a censoring indicator is included. Ensemble machine learning may be used to construct the initial estimates of nuisance functions using sl3.
Value
S3 object of class txshift
containing the results of the
procedure to compute a TML or one-step estimate of the counterfactual mean
under a modified treatment policy that shifts a continuous-valued exposure
by a scalar amount delta
. These estimates can be augmented to be
consistent and efficient when two-phase sampling is performed.
Examples
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_samp <- rbinom(n_obs, 1, plogis(W + Y)) # two-phase sampling
C_cens <- rbinom(n_obs, 1, plogis(rowSums(W) + 0.5))
# construct a TML estimate, ignoring censoring
tmle <- txshift(
W = W, A = A, Y = Y, delta = 0.5,
estimator = "onestep",
g_exp_fit_args = list(
fit_type = "hal",
n_bins = 3,
lambda_seq = exp(seq(-1, -10, length = 50))
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
)
)
## Not run:
# construct a TML estimate, accounting for censoring
tmle <- txshift(
W = W, A = A, C_cens = C_cens, Y = Y, delta = 0.5,
estimator = "onestep",
g_exp_fit_args = list(
fit_type = "hal",
n_bins = 3,
lambda_seq = exp(seq(-1, -10, length = 50))
),
g_cens_fit_args = list(
fit_type = "glm",
glm_formula = "C_cens ~ ."
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
)
)
# construct a TML estimate under two-phase sampling, ignoring censoring
ipcwtmle <- txshift(
W = W, A = A, Y = Y, delta = 0.5,
C_samp = C_samp, V = c("W", "Y"),
estimator = "onestep", max_iter = 3,
samp_fit_args = list(fit_type = "glm"),
g_exp_fit_args = list(
fit_type = "hal",
n_bins = 3,
lambda_seq = exp(seq(-1, -10, length = 50))
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
),
eif_reg_type = "glm"
)
# construct a TML estimate acconting for two-phase sampling and censoring
ipcwtmle <- txshift(
W = W, A = A, C_cens = C_cens, Y = Y, delta = 0.5,
C_samp = C_samp, V = c("W", "Y"),
estimator = "onestep", max_iter = 3,
samp_fit_args = list(fit_type = "glm"),
g_exp_fit_args = list(
fit_type = "hal",
n_bins = 3,
lambda_seq = exp(seq(-1, -10, length = 50))
),
g_cens_fit_args = list(
fit_type = "glm",
glm_formula = "C_cens ~ ."
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
),
eif_reg_type = "glm"
)
## End(Not run)