wald_test.adaptive_iptw {drtmle} | R Documentation |
Wald tests for adaptive_iptw objects
Description
Wald tests for adaptive_iptw objects
Usage
## S3 method for class 'adaptive_iptw'
wald_test(object, est = c("iptw_tmle"), null = 0, contrast = NULL, ...)
Arguments
object |
An object of class |
est |
A vector indicating for which estimators to return a confidence
interval. Possible estimators include the TMLE IPTW ( |
null |
The null hypothesis value(s). |
contrast |
This option specifies what parameter to return confidence
intervals for. If |
... |
Other options (not currently used). |
Value
An object of class "ci.adaptive_iptw"
with point estimates and
confidence intervals of the specified level.
Examples
# load super learner
library(SuperLearner)
# fit adaptive_iptw
set.seed(123456)
n <- 200
W <- data.frame(W1 = runif(n), W2 = rnorm(n))
A <- rbinom(n, 1, plogis(W$W1 - W$W2))
Y <- rbinom(n, 1, plogis(W$W1 * W$W2 * A))
fit1 <- adaptive_iptw(
W = W, A = A, Y = Y, a_0 = c(1, 0),
SL_g = c("SL.glm", "SL.mean", "SL.step"),
SL_Qr = "SL.glm"
)
# get test that each mean = 0.5
test_mean <- wald_test(fit1, null = 0.5)
# get test that the ATE = 0
ci_ATE <- ci(fit1, contrast = c(1, -1), null = 0)
# get test for risk ratio = 1 on log scale
myContrast <- list(
f = function(eff) {
log(eff)
},
f_inv = function(eff) {
exp(eff)
}, # not necessary
h = function(est) {
est[1] / est[2]
},
fh_grad = function(est) {
c(1 / est[1], -1 / est[2])
}
)
ci_RR <- ci(fit1, contrast = myContrast, null = 1)
#