chooseM: Adaptive Choice of the Bootstrap Resample Size M

View source: R/chooseM.R

chooseMR Documentation

Adaptive Choice of the Bootstrap Resample Size M

Description

Implementation of a double-bootstrap algorithm for choosing the bootstrap resample size m in a data-adaptive manner. The function returns the resample size to be used to apply the m-out-of-n bootstrap with DTRreg.

Usage

chooseM(
  outcome,
  blip.mod,
  treat.mod,
  tf.mod,
  data = NULL,
  method = c("gest", "dwols", "qlearn"),
  treat.type = c("bin", "multi", "cont"),
  treat.fam = gaussian(link = "identity"),
  weight = c("abs", "ipw", "cipw", "qpom", "wo", "none", "manual"),
  n.bins = 3L,
  treat.wgt.man = NULL,
  treat.range = NULL,
  missing = c("drop", "ipw"),
  missing.mod = NULL,
  B1 = 500,
  B2 = 500
)

Arguments

outcome

The outcome variable. Missing data will result in a stopping error.

blip.mod

A list of formula objects specifying covariates of the blip function for each stage in order. No dependent variable should be specified. Note that this input should include the treatment variable ONLY if the blip model is quadratic in treatment. See Details for further clarification.

treat.mod

A list of formula objects specifying the treatment model for each stage in order. Treatment variable should be included as the dependent variable. If treatment is binary glm(family = binomial) will be used to obtain parameter estimates; if treatment is multi-nomial, multinom() will be used to obtain parameter estimates; and if treatment is continuous, lm() will be used.

tf.mod

A list of formula objects specifying covariates of the treatment-free model for each stage in order. No dependent variable should be specified.

data

A data frame containing all necessary covariates and treatments contained in the models. Missing data should be coded as NA.

method

The DTR method to be used, choose "dwols" for dynamic WOLS, "gest" for G-estimation, or "qlearn" for Q-learning.

treat.type

A character object. Must be one of {"bin", "multi", "cont"} indicating that the treatments at each stage are binary, multinomial, or continuous, respectively. Each stage must have the same treatment type.

treat.fam

A character or family object. The description of the dose distribution along with the link function to be used in the treatment model for computing weights; should be specified in a similar format as that used in glm(). If character object, must be one of {"gaussian", "Gamma"}, for which gaussian(link = "identity") or Gamma(link = "log") will be used, respectively. Input is ignored for treat.type = "bin" and treat.type = "multi".

weight

The form of the treatment weight. See details.

n.bins

An integer object. The number of bins (levels) to be used for categorizing continuous doses. This input is required only when treat.type = "cont" and weight = "wo" or weight = "qpom".

treat.wgt.man

NULL or a list of vectors of known treatment weights can be specified to be used instead of hard-coded treatment weight options. The i^{th} element of the list contains the multiplicative weights for the i^{th} stage. Each vector must be of length n, the number of participants. Used only for method = "dwols".

treat.range

For continuous treatments. Specify the maximum/minimum value that treatments can be take. If unspecified then the minimum/maximum value of observed treatments is used. If you wish to have unrestricted treatments set this option to c(-Inf, +Inf). If each stage has its own range, provide as a list, the ith element providing the min and max for the ith stage treatment.

missing

A character object. Must be one of {"drop", "ipw"}. If set to "ipw" and covariate or treatment data are missing then inverse probability weights are used. The complete case probability is estimated via logistic regression. If set to "drop" and data are missing, participants with missing data are dropped for all stage analyses.

missing.mod

An optional list of formula objects specifying the model for the inverse probability of weights for each stage in order. No dependent variable should be specified. If missing = "ipw" and missing.mod = NULL, then the models are assumed to be linear comprising the full covariate history derived from all of the previous stage models.

B1

Number of first-level bootstrap resamples.

B2

Number of second-level bootstrap resamples.

Details

The m-out-of-n bootstrap is an adequate tool for constructing valid confidence intervals for the first stage parameters in DTRreg. The resample size m is: m = n^{\frac{1 + \alpha(1-\hat{p})}{1+\alpha}}. The estimated non-regularity level is computed by DTRreg. The double-bootstrap algorithm is a cross-validation tool for choosing the tuning parameter \alpha in a data-driven way.

The current implementation is valid for a two-stage DTR. Moreover, the current implementation may be unstable when there are many missing data.

Value

A list with a single element

m

Resample size for using in the m-out-of-n bootstrap.

Author(s)

Gabrielle Simoneau

References

Chakraborty, B., Moodie, E. E. M. (2013) Statistical Methods for Dynamic Treatment Regimes. New York: Springer.

Efron B., Tibshirani R. J. (1994) An Introduction to the Bootstrap. CRC press.

Wallace, M. P., Moodie, E. M. (2015) Doubly-Robust Dynamic Treatment Regimen Estimation Via Weighted Least Squares. Biometrics 71(3), 636–644 (doi:10.1111/biom.12306.)

Examples

data(twoStageCont)

# models to be passed to DTRreg
# blip model
blip.mod <- list(~ X1, ~ X2)
# treatment model (correctly specified)
treat.mod <- list(A1 ~ X1, A2 ~ X2)
# treatment-free model (incorrectly specified)
tf.mod <- list(~ X1, ~ X2)

# perform dWOLS without calculating confidence intervals
mod1 <- DTRreg(twoStageCont$Y, blip.mod, treat.mod, tf.mod, 
               data = twoStageCont, method = "dwols")
  
# choose m adaptively for that model
## Not run: 
  m <- chooseM(twoStageCont$Y, blip.mod, treat.mod, tf.mod, 
               data = twoStageCont, method = "dwols",
               B1 = 200, B2 = 200)$m

## End(Not run)
m <- 94
  
# dWOLS with confidence intervals from the m-out-of-n bootstrap
mod2 <- DTRreg(twoStageCont$Y, blip.mod, treat.mod, tf.mod, 
               data = twoStageCont, method = "dwols",
               var.estim = "bootstrap", 
               bootstrap.controls = list(M = m))

DTRreg documentation built on Nov. 20, 2023, 1:06 a.m.

Related to chooseM in DTRreg...