SDE_tmle: SDE_tmle

Description Usage Arguments Value Examples

Description

computes the sequential regression, targeted maximum likelihood estimate for the stochastic direct effect and stochastic indirect effect for mediation effects with an intermediate confounder present when the outcome and mediator model are only available on site 1 (S = 1). This is a data adaptive parameter as the stochastic direct effect has a model for the mediator is determined on the data for site 1. The estimates are for this parameter transported to another site (S=0. We note, we are working on future generalizations to allow the mediator to be present for both sites and also to allow specification of separate superlearners for all models that are fitted. Also computes non-transported parameter, see below. In addition, along the way, this function computes the one step estimator (estimating equations based) and iptw estimators.

Usage

1
2
SDE_tmle(data, sl, V = 10, covariates, truncate = list(lower = 1e-04, upper
  = 0.9999), alpha = 0.05, transport = TRUE)

Arguments

data,

data.frame of variables in time ordering from left to right. Make sure if using a continuous outcome that it is scaled to be between 0 and 1 via (Y - minY)/(maxY - minY). The mediator M, intermediate confounder Z, treatment A,and site S are all binaries and must be named as such.

sl

the sl3 superlearner defined, see sl3 documentation for defining a superlearner and the example below

V

number of folds for cross-validation (fixed to 10 for now)

covariates,

dataframe of covariates for each necessary model, going backwards from the outcome.

truncate,

a list with elements lower and upper to truncate the various p-scores not functional at present

alpha

= type I error rate

transport

if FALSE then there is no site variable considered

a,

the treatment intervention of interest, either 0 or 1

a_star,

the treatment intervention of the stochastic model for Mediator, M, either 0 or 1.

Value

a list with the following elements: CI are the confidence intervals for tmle, one step estimator, iptw estimators for stochastic direct and indirect effects

IC is a dataframe of influence curve approximations for tmle, the one step estimator, and iptw estimator for both stochastic direct and indirect effects

gcomp_ests are tochastic direct and indirect effects for gcomp, IC inference is generally not valid here so no confidence interval offered.

fluctuation_eps: The tmle here uses the clever covariate as a weight in an intercept logistic regression model. This returns the intercepts for the three parameters defined as means, respectively, under the stochastic interventions astar = a = 0, astar = a = 1 and astar = 0 with a = 1.

Examples

 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
40
41
42
43
44
45
46
47
data(data_example)
head(data_example)

covariates = list(covariates_S = c("W1","W2"),
                  covariates_A = c("S","W1", "W2"),
                  covariates_Z = c("S","A","W1","W2"),
                  covariates_M = c("Z","W1","W2"),
                  covariates_Y = c("M","Z","W1","W2"),
                  covariates_QZ = c("S","W1","W2"))

# make the superlearner using sl3
lglm = make_learner(Lrnr_glm)
lmean = make_learner(Lrnr_mean)
# lxgboost = make_learner(Lrnr_xgboost)
lrnr_stack = make_learner(Stack, list(lglm, lmean))
metalearner = make_learner(Lrnr_nnls)

# define the superlearner
sl <- Lrnr_sl$new(learners = lrnr_stack,
                  metalearner = metalearner)

# takes about 9 seconds
time = proc.time()
result = SDE_tmle(data_example, sl = sl, covariates = covariates, 
                   truncate = list(lower =.0001, upper = .9999), alpha = .05, transport = TRUE)
proc.time() - time 

result$CI
head(result$IC)
result$gcomp_ests
result$fluctuation_eps

# If not transporting:
covariatesNT = list(
                  covariates_A = c("W1", "W2"),
                  covariates_Z = c("A","W1","W2"),
                  covariates_M = c("Z","W1","W2"),
                  covariates_Y = c("M","Z","W1","W2"),
                  covariates_QZ = c("W1","W2"))
# debug(SDE_tmleNT)
resultNT = SDE_tmle(data_example, sl = sl, covariates = covariatesNT, 
                    truncate = list(lower =.0001, upper = .9999), alpha = .05, transport = FALSE)

resultNT$CI
head(resultNT$IC)
resultNT$gcomp_ests
resultNT$fluctuation_eps

jlstiles/SDEtransport documentation built on May 31, 2019, 5:41 a.m.