adaptive_iptw: Compute asymptotically linear IPTW estimators with super...

View source: R/adaptive_iptw.R

adaptive_iptwR Documentation

Compute asymptotically linear IPTW estimators with super learning for the propensity score

Description

Compute asymptotically linear IPTW estimators with super learning for the propensity score

Usage

adaptive_iptw(W, A, Y, DeltaY = as.numeric(!is.na(Y)),
  DeltaA = as.numeric(!is.na(A)), stratify = FALSE, family = if (all(Y
  %in% c(0, 1))) {     stats::binomial() } else {     stats::gaussian() },
  a_0 = unique(A[!is.na(A)]), SL_g = NULL, glm_g = NULL, SL_Qr = NULL,
  glm_Qr = NULL, returnModels = TRUE, verbose = FALSE, maxIter = 2,
  tolIC = 1/length(Y), tolg = 0.01, cvFolds = 1, gn = NULL, ...)

Arguments

W

A data.frame of named covariates

A

A numeric vector of binary treatment assignment (assumed to be equal to 0 or 1)

Y

A numeric numeric of continuous or binary outcomes.

DeltaY

A numeric indicator of missing outcome (assumed to be equal to 0 if missing 1 if observed)

DeltaA

A numeric indicator of missing treatment (assumed to be equal to 0 if missing 1 if observed)

stratify

A logical indicating whether to estimate the missing outcome regression separately for observations with different levels of A (if TRUE) or to pool across A (if FALSE).

family

A family object equal to either binomial() or gaussian(), to be passed to the SuperLearner or glm function.

a_0

A vector of numeric treatment values at which to return marginal mean estimates.

SL_g

A vector of characters describing the super learner library to be used for each of the propensity score regressions (DeltaA, A, and DeltaY). To use the same library for each of the regressions (or if there is no missing data in A nor Y), a single library may be input. See link{SuperLearner::SuperLearner} for details on how super learner libraries can be specified.

glm_g

A list of characters describing the formulas to be used for each of the propensity score regressions (DeltaA, A, and DeltaY). To use the same formula for each of the regressions (or if there is no missing data in A nor Y), a single character formula may be input.

SL_Qr

A vector of characters or a list describing the Super Learner library to be used for the reduced-dimension outcome regression.

glm_Qr

A character describing a formula to be used in the call to glm for reduced-dimension outcome regression. Ignored if SL_Qr!=NULL. The formula should use the variable name 'gn'.

returnModels

A logical indicating whether to return model fits for the propensity score and reduced-dimension regressions.

verbose

A logical indicating whether to print status updates.

maxIter

A numeric that sets the maximum number of iterations the TMLE can perform in its fluctuation step.

tolIC

A numeric that defines the stopping criteria based on the empirical mean of the influence function.

tolg

A numeric indicating the minimum value for estimates of the propensity score.

cvFolds

A numeric equal to the number of folds to be used in cross-validated fitting of nuisance parameters. If cvFolds = 1, no cross-validation is used.

gn

An optional list of propensity score estimates. If specified, the function will ignore the nuisance parameter estimation specified by SL_g and glm_g. The entries in the list should correspond to the propensity for the observed values of W, with order determined by the input to a_0 (e.g., if a_0 = c(0,1) then gn[[1]] should be propensity of A = 0 and gn[[2]] should be propensity of A = 1).

...

Other options (not currently used).

Value

An object of class "adaptive_iptw".

iptw_tmle

A list of point estimates and covariance matrix for the IPTW estimator based on a targeted propensity score.

iptw_tmle_nuisance

A list of the final TMLE estimates of the propensity score ($gnStar) and reduced-dimension regression ($QrnStar) evaluated at the observed data values.

iptw_os

A list of point estimates and covariance matrix for the one-step correct IPTW estimator.

iptw_os_nuisance

A list of the initial estimates of the propensity score and reduced-dimension regression evaluated at the observed data values.

iptw

A list of point estimates for the standard IPTW estimator. No estimate of the covariance matrix is provided because theory does not support asymptotic Normality of the IPTW estimator if super learning is used to estimate the propensity score.

gnMod

The fitted object for the propensity score. Returns NULL if returnModels = FALSE.

QrnMod

The fitted object for the reduced-dimension regression that guards against misspecification of the outcome regression. Returns NULL if returnModels = FALSE.

a_0

The treatment levels that were requested for computation of covariate-adjusted means.

call

The call to adaptive_iptw.

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 iptw with maxIter = 1 to run fast

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.npreg", maxIter = 1
)


benkeser/drtmle documentation built on Jan. 6, 2023, 11:40 a.m.