twoStageTMLEmsm {twoStageDesignTMLE} | R Documentation |
twoStageTMLEmsm
Description
Inverse probability of censoring weighted TMLE for evaluating MSM parameters when the full set of covariates is available on only a subset of observations, as in a 2-stage design.
Usage
twoStageTMLEmsm(
Y,
A,
W,
V,
Delta.W,
W.stage2,
Delta = rep(1, length(Y)),
pi = NULL,
piform = NULL,
pi.SL.library = c("SL.glm", "SL.gam", "SL.glmnet", "tmle.SL.dbarts.k.5"),
V.pi = 10,
pi.discreteSL = TRUE,
condSetNames = c("A", "V", "W", "Y"),
id = NULL,
Q.family = "gaussian",
augmentW = TRUE,
augW.SL.library = c("SL.glm", "SL.glmnet", "tmle.SL.dbarts2"),
rareOutcome = FALSE,
verbose = FALSE,
...
)
Arguments
Y |
outcome of interest (missingness allowed) |
A |
binary treatment indicator |
W |
matrix or data.frame of covariates measured on entire population |
V |
vector, matrix, or dataframe of covariates used to define MSM strata |
Delta.W |
Indicator of inclusion in subset with additional information |
W.stage2 |
matrix or data.frame of covariates measured in subset population |
Delta |
binary indicator that outcome Y is observed |
pi |
optional vector of sampling probabilities |
piform |
optional parametric regression model for estimating pi |
pi.SL.library |
optional SL library specification for estimating pi (ignored when piform or pi is provided) |
V.pi |
optional number of cross-validation folds for super learning (ignored when piform or pi is provided) |
pi.discreteSL |
flag to indicate whether to use ensemble or discrete super learning (ignored when piform or pi is provided) |
condSetNames |
variables to condition on when estimating pi. Default is
covariates in |
id |
optional indicator of independent units of observation |
Q.family |
outcome regression family, "gaussian" or "binomial" |
augmentW |
set to |
augW.SL.library |
super learner library for preliminary outcome
regression model (ignored when |
rareOutcome |
when |
verbose |
when |
... |
other arugments passed to the |
Value
Object of class "twoStageTMLE"
- tmle
Treatment effect estimates and summary information from call to
tmleMSM
function- twoStage
IPCW weight estimation summary,
pi
are the probabilities,coef
are SL weights or coefficients from glm fit,type
of estimation procedure,discreteSL
flag indicating whether discrete super learning was used- augW
Matrix of predicted outcomes based on stage 1 covariates only
See Also
-
tmle::tmleMSM()
for details on customizing the estimation procedure -
twoStageTMLE()
for estimating marginal effects
Examples
n <- 1000
set.seed(10)
W1 <- rnorm(n)
W2 <- rnorm(n)
W3 <- rnorm(n)
A <- rbinom(n, 1, plogis(-1 + .2*W1 + .3*W2 + .1*W3))
Y <- 10 + A + W1 + W2 + A*W1 + W3 + rnorm(n)
Y.bin <- rbinom(n, 1, plogis(-4.6 - 1.8* A + W1 + W2 -.3 *A*W1 + W3))
# Set 400 obs with data on W3, more likely if W1 > 1
n.sample <- 400
p.sample <- 0.5 + .2*(W1 > 1)
rows.sample <- sample(1:n, size = n.sample, p = p.sample)
Delta.W <- rep(0,n)
Delta.W[rows.sample] <- 1
W3.stage2 <- cbind(W3 = W3[Delta.W==1])
# 1. specify parametric models, misspecified outcome model (not recommended)
result1.MSM <- twoStageTMLEmsm(Y=Y, A=A, V= cbind(W1), W=cbind(W2),
Delta.W = Delta.W, W.stage2 = W3.stage2, augmentW = FALSE,
piform = "Delta.W~ I(W1 > 0)", MSM = "A*W1", augW.SL.library = "SL.glm",
Qform = "Y~A+W1",gform="A~W1 + W2 +W3", hAVform = "A~1", verbose=TRUE)
summary(result1.MSM)
# 2. Call again, passing in previously estimated observation weights,
# note that specifying a correct model for Q improves efficiency
result2.MSM <- twoStageTMLEmsm(Y=Y, A=A, V= cbind(W1), W=cbind(W2),
Delta.W = Delta.W, W.stage2 = W3.stage2, augmentW = FALSE,
pi = result1.MSM$twoStage$pi, MSM = "A*W1",
Qform = "Y~ A + W1 + W2 + A*W1 + W3",gform="A~W1 + W2 +W3", hAVform = "A~1")
cbind(SE.Qmis = result1.MSM$tmle$se, SE.Qcor = result2.MSM$tmle$se)
#Binary outcome, augmentW, rareOutcome
result3.MSM <- twoStageTMLEmsm(Y=Y.bin, A=A, V= cbind(W1), W=cbind(W2),
Delta.W = Delta.W, W.stage2 = W3.stage2, augmentW = TRUE,
piform = "Delta.W~ I(W1 > 0)", MSM = "A*W1", gform="A~W1 + W2 +W3",
Q.family = "binomial", rareOutcome=TRUE)