Title: | Causal mediation analysis for stochastic interventions |
---|---|
Description: | Estimators of a parameter arising in the decomposition of the population intervention (in)direct effect of stochastic interventions in causal mediation analysis, including efficient one-step, targeted minimum loss (TML), re-weighting (IPW), and substitution estimators. The parameter estimated constitutes a part of each of the population intervention (in)direct effects. These estimators may be used in assessing population intervention (in)direct effects under stochastic treatment regimes, including incremental propensity score interventions and modified treatment policies. The methodology was first discussed by I Díaz and NS Hejazi (2020) <doi:10.1111/rssb.12362>. |
Authors: | Nima Hejazi [aut, cre, cph] , Iván Díaz [aut] , Mark van der Laan [ctb, ths] , Jeremy Coyle [ctb] |
Maintainer: | Nima Hejazi <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.4 |
Built: | 2024-10-29 02:47:22 UTC |
Source: | https://github.com/nhejazi/medshift |
Compute confidence intervals for objects of class medshift
, which
contain estimates produced by medshift
.
## S3 method for class 'medshift' confint(object, parm = seq_len(object$psi), level = 0.95, ...)
## S3 method for class 'medshift' confint(object, parm = seq_len(object$psi), level = 0.95, ...)
object |
An object of class |
parm |
A |
level |
A |
... |
Other arguments. Not currently used. |
Inverse probability weighted (IPW) estimator
est_ipw(data, delta, g_learners, e_learners, w_names, z_names, ...)
est_ipw(data, delta, g_learners, e_learners, w_names, z_names, ...)
data |
A |
delta |
A |
g_learners |
A |
e_learners |
A |
w_names |
A |
z_names |
A |
... |
Other arguments currently ignored. |
Efficient One-Step Estimator
est_onestep(data, delta, g_learners, e_learners, m_learners, phi_learners, w_names, z_names, cv_folds = 10)
est_onestep(data, delta, g_learners, e_learners, m_learners, phi_learners, w_names, z_names, cv_folds = 10)
data |
A |
delta |
A |
g_learners |
A |
e_learners |
A |
m_learners |
A |
phi_learners |
A |
w_names |
A |
z_names |
A |
cv_folds |
A |
Substitution estimator
est_substitution(data, delta, g_learners, m_learners, w_names, z_names, ...)
est_substitution(data, delta, g_learners, m_learners, w_names, z_names, ...)
data |
A |
delta |
A |
g_learners |
A |
m_learners |
A |
w_names |
A |
z_names |
A |
... |
Other arguments currently ignored. |
Fit propensity score regression while conditioning on mediators
fit_e_mech(data, valid_data = NULL, learners, z_names, w_names)
fit_e_mech(data, valid_data = NULL, learners, z_names, w_names)
data |
A |
valid_data |
A holdout data set, with columns exactly matching those
appearing in the preceding argument |
learners |
A |
z_names |
A |
w_names |
A |
Fit propensity score with incremental stochastic shift intervention
fit_g_mech(data, valid_data = NULL, delta, learners, w_names)
fit_g_mech(data, valid_data = NULL, delta, learners, w_names)
data |
A |
valid_data |
A holdout data set, with columns exactly matching those
appearing in the preceding argument |
delta |
A |
learners |
A |
w_names |
A |
Fit outcome regression
fit_m_mech(data, valid_data = NULL, learners, z_names, w_names)
fit_m_mech(data, valid_data = NULL, learners, z_names, w_names)
data |
A |
valid_data |
A holdout data set, with columns exactly matching those
appearing in the preceding argument |
learners |
A |
z_names |
A |
w_names |
A |
Fit intervention-specific exponential tilt nuisance parameter
fit_phi_mech(train_data, valid_data, learners, m_output, w_names)
fit_phi_mech(train_data, valid_data, learners, m_output, w_names)
train_data |
A |
valid_data |
A holdout data set, with columns exactly matching those
appearing in the preceding argument |
learners |
A |
m_output |
Object containing results from fitting the outcome
regression, as produced by |
w_names |
A |
Likelihood Factor for Incremental Propensity Score Interventions
R6Class
object.
LF_base
object.
define_lf(LF_ipsi, name, type = "density", likelihood_base,
shift_param, treatment_task, control_task, ...)
name
A character
, giving the name of the likelihood
factor. Should match a node name in the nodes specified by the
npsem
slot of tmle3_Task
.
likelihood_base
A trained Likelihood
object, for use in generating a re-scaled likelihood factor.
shift_param
A numeric
, specifying the magnitude of
the desired incremental propensity score shift (a multiplier of
the odds of receiving treatment).
treatment_task
A tmle3_Task
object
created by setting the intervention to the treatment condition:
do(A = 1).
control_task
A tmle3_Task
object
created by setting the intervention to the control condition:
do(A = 0).
...
Not currently used.
likelihood_base
A trained Likelihood
object, for use in generating a re-scaled likelihood factor.
shift_param
A numeric
, specifying the magnitude of
the desired incremental propensity score shift (a multiplier of
the odds of receiving treatment).
treatment_task
A tmle3_Task
object
created by setting the intervention to the treatment condition:
do(A = 1).
control_task
A tmle3_Task
object
created by setting the intervention to the control condition:
do(A = 0).
...
Additional arguments passed to the base class.
Kennedy, Edward H (2019). Journal of the American Statistical Association. https://doi.org/10.1080/01621459.2017.1422737
Díaz, Iván and Hejazi, Nima S (2020). Journal of the Royal Statistical Society, Series B. https://doi.org/10.1111/rssb.12362
Nonparametric estimation of the population intervention (in)direct effects
medshift(W, A, Z, Y, ids = seq_along(Y), delta, g_learners = sl3::Lrnr_glm$new(), e_learners = sl3::Lrnr_glm$new(), m_learners = sl3::Lrnr_glm$new(), phi_learners = sl3::Lrnr_glm$new(), estimator = c("onestep", "tmle", "substitution", "reweighted"), estimator_args = list(cv_folds = 10, max_iter = 10000, step_size = 1e-06))
medshift(W, A, Z, Y, ids = seq_along(Y), delta, g_learners = sl3::Lrnr_glm$new(), e_learners = sl3::Lrnr_glm$new(), m_learners = sl3::Lrnr_glm$new(), phi_learners = sl3::Lrnr_glm$new(), estimator = c("onestep", "tmle", "substitution", "reweighted"), estimator_args = list(cv_folds = 10, max_iter = 10000, step_size = 1e-06))
W |
A |
A |
A |
Z |
A |
Y |
A |
ids |
A |
delta |
A |
g_learners |
A |
e_learners |
A |
m_learners |
A |
phi_learners |
A |
estimator |
The desired estimator of the natural direct effect to be computed. Currently, choices are limited to a substitution estimator, a re-weighted estimator, a one-step estimator, and a targeted minimum loss estimator. |
estimator_args |
A |
Parameter definition class. See https://doi.org/10.1111/rssb.12362.
R6Class
object.
Param_base
object.
define_param(Param_medshift, shift_param, ..., outcome_node)
observed_likelihood
A Likelihood
corresponding to the observed likelihood.
shift_param
A numeric
, specifying the magnitude of
the desired incremental propensity score shift (a multiplier of
the odds of receiving treatment).
...
Not currently used.
outcome_node
A character
, giving the name of the
node that should be treated as the outcome.
cf_likelihood
The counterfactual likelihood under the joint stochastic intervention on exposure and mediators.
lf_ipsi
Object derived from LF_base
for assessing the joint intervention on exposure and mediators.
treatment_task
A tmle3_Task
created
by setting the intervention to the treatment condition:
do(A = 1).
control_task
A tmle3_Task
object created by
setting the intervention to the control condition: do(A = 0).
shift_param
A numeric
, specifying the magnitude of
the desired incremental propensity score shift (a multiplier of
the odds of receiving treatment).
One-step or TML estimation of the population intervention direct effect
pide(W, A, Z, Y, ids = seq(1, length(Y)), delta, estimator = c("onestep", "tmle"), ci_level = 0.95, ...)
pide(W, A, Z, Y, ids = seq(1, length(Y)), delta, estimator = c("onestep", "tmle"), ci_level = 0.95, ...)
W |
A |
A |
A |
Z |
A |
Y |
A |
ids |
A |
delta |
A |
estimator |
The desired estimator of the natural direct effect to be computed. Currently, choices are limited to a substitution estimator, a re-weighted estimator, a one-step estimator, and a targeted minimum loss estimator. |
ci_level |
A |
... |
Additional arguments passed to |
The print
method for objects of class medshift
.
## S3 method for class 'medshift' print(x, ...)
## S3 method for class 'medshift' print(x, ...)
x |
An object of class |
... |
Other options (not currently used). |
Print a convenient summary for objects of S3
class medshift
.
## S3 method for class 'medshift' summary(object, ..., ci_level = 0.95)
## S3 method for class 'medshift' summary(object, ..., ci_level = 0.95)
object |
An object of class |
... |
Other arguments. Not currently used. |
ci_level |
A |
Hypothesis test of direct effect with mediated stochastic interventions using the multiplier bootstrap
test_de(W, A, Z, Y, ids = seq(1, length(Y)), delta_grid = seq(from = 0.5, to = 5, by = 0.9), mult_type = c("rademacher", "gaussian"), ci_level = 0.95, g_learners, e_learners, m_learners, phi_learners, cv_folds = 10, n_mult = 10000)
test_de(W, A, Z, Y, ids = seq(1, length(Y)), delta_grid = seq(from = 0.5, to = 5, by = 0.9), mult_type = c("rademacher", "gaussian"), ci_level = 0.95, g_learners, e_learners, m_learners, phi_learners, cv_folds = 10, n_mult = 10000)
W |
A |
A |
A |
Z |
A |
Y |
A |
ids |
A |
delta_grid |
A |
mult_type |
A |
ci_level |
A |
g_learners |
A |
e_learners |
A |
m_learners |
A |
phi_learners |
A |
cv_folds |
A |
n_mult |
A |
O = (W, A, Z, Y) W = Covariates (possibly multivariate) A = Treatment (binary or categorical) Z = Mediators (binary or categorical; possibly multivariate) Y = Outcome (binary or bounded continuous)
tmle_medshift(shift_type = "ipsi", delta, e_learners, phi_learners, max_iter = 10000, step_size = 1e-06, ...)
tmle_medshift(shift_type = "ipsi", delta, e_learners, phi_learners, max_iter = 10000, step_size = 1e-06, ...)
shift_type |
A |
delta |
A |
e_learners |
A |
phi_learners |
A |
max_iter |
A |
step_size |
A |
... |
Additional arguments (currently unused). |
TML Estimator for the Counterfactual Mean of a Joint Stochastic Intervention Defining the Population Intervention (In)direct Effects