ci.drtmle {drtmle}R Documentation

Confidence intervals for drtmle objects

Description

Confidence intervals for drtmle objects

Usage

## S3 method for class 'drtmle'
ci(object, est = c("drtmle"), level = 0.95, contrast = NULL, ...)

Arguments

object

An object of class "drtmle"

est

A vector indicating for which estimators to return a confidence interval. Possible estimators include the TMLE with doubly robust inference ("drtmle", recommended), the AIPTW with additional correction for misspecification ("aiptw_c", not recommended), the standard TMLE ("tmle", recommended only for comparison to "drtmle"), the standard AIPTW ("aiptw", recommended only for comparison to "drtmle"), and G-computation ("gcomp", not recommended).

level

The nominal coverage probability of the desired confidence interval (should be between 0 and 1). Default computes 95\ intervals.

contrast

Specifies the parameter for which to return confidence intervals. If contrast=NULL, then confidence intervals for the marginal means are computed. If instead, contrast is a numeric vector of ones, negative ones, and zeros to define linear combinations of the various means (e.g., to estimate an average treatment effect, see example). Finally, contrast can be a list with named functions f, f_inv, h, and fh_grad. The first two functions should take as input argument eff. Respectively, these specify which transformation of the effect measure to compute the confidence interval for and the inverse transformation to put the confidence interval back on the original scale. The function h defines the contrast to be estimated and should take as input est, a vector of the same length as object$a_0, and output the desired contrast. The function fh_grad is the gradient of the function h. See examples and vignette for more information.

...

Other options (not currently used).

Value

An object of class "ci.drtmle" with point estimates and confidence intervals of the specified level.

Examples

# load super learner
library(SuperLearner)
# simulate data
set.seed(123456)
n <- 100
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))

# fit drtmle with maxIter = 1 to run fast
fit1 <- drtmle(
  W = W, A = A, Y = Y, a_0 = c(1, 0),
  family = binomial(),
  stratify = FALSE,
  SL_Q = c("SL.glm", "SL.mean"),
  SL_g = c("SL.glm", "SL.mean"),
  SL_Qr = "SL.npreg",
  SL_gr = "SL.npreg", maxIter = 1
)

# get confidence intervals for each mean
ci_mean <- ci(fit1)

# get confidence intervals for ATE
ci_ATE <- ci(fit1, contrast = c(1, -1))

# get confidence intervals for risk ratio by
# computing CI on log scale and back-transforming
myContrast <- list(
  f = function(eff) {
    log(eff)
  },
  f_inv = function(eff) {
    exp(eff)
  },
  h = function(est) {
    est[1] / est[2]
  },
  fh_grad = function(est) {
    c(1 / est[1], -1 / est[2])
  }
)
ci_RR <- ci(fit1, contrast = myContrast)


[Package drtmle version 1.1.2 Index]