checkInputs: Check Function Inputs

View source: R/checkInputs.R

checkInputsR Documentation

Check Function Inputs

Description

Check the input values of function parameters for errors.

Usage

checkInputs(
  ftime,
  ftype,
  trt,
  adjustVars,
  t0 = max(ftime[ftype > 0]),
  SL.ftime = NULL,
  SL.ctime = NULL,
  SL.trt = NULL,
  glm.ftime = NULL,
  glm.ctime = NULL,
  glm.trt = "1",
  att = FALSE,
  returnIC = TRUE,
  returnModels = TRUE,
  ftypeOfInterest = unique(ftype[ftype != 0]),
  trtOfInterest = unique(trt),
  method = "hazard",
  bounds = NULL,
  verbose = FALSE,
  tol = 1/(length(ftime)),
  maxIter = 100,
  Gcomp = FALSE,
  stratify = FALSE
)

Arguments

ftime

A numeric vector of failure times. Right-censored observations should have corresponding ftype set to 0.

ftype

A numeric vector indicating the type of failure. Observations with ftype == 0 are treated as right-censored. Each unique value besides zero is treated as a separate type of failure.

trt

A numeric vector indicating observed treatment assignment. Each unique value will be treated as an (unordered) separate type of treatment. Currently, only two unique values of trt are supported.

adjustVars

A data.frame of adjustment variables that will be used in estimating the conditional treatment, censoring, and failure (hazard or conditional mean) probabilities.

t0

The time at which to return cumulative incidence estimates. By default this is set to max(ftime).

SL.ftime

A character vector or list specification to be passed to the SL.library argument in the call to SuperLearner for the outcome regression (either cause-specific hazards or conditional mean). See the documentation of SuperLearner for more information on how to specify valid SuperLearner libraries. It is expected that the wrappers used in the library will play nicely with the input variables, which will be called "trt" and names(adjustVars).

SL.ctime

A character vector or list specification to be passed to SL.library in the call to SuperLearner for the estimate of the conditional hazard for censoring. It is expected that the wrappers used in the library will play nicely with the input variables, which will be called "trt" and names(adjustVars).

SL.trt

A character vector or list specification to be passed to SL.library in the call to SuperLearner for the estimate of the conditional probability of treatment. It is expected that the wrappers used in the library will play nicely with the input variables, which will be names(adjustVars).

glm.ftime

A character specification of the right-hand side of the equation passed to the formula option of a call to glm for the outcome regression (either cause-specific hazards or conditional mean). Ignored if SL.ftime != NULL. Use "trt" to specify the treatment in this formula (see examples). The formula can additionally include any variables found in names(adjustVars).

glm.ctime

A character specification of the right-hand side of the equation passed to the formula option of a call to glm for the estimate of the conditional hazard for censoring. Ignored if SL.ctime != NULL. Use "trt" to specify the treatment in this formula (see examples). The formula can additionally include any variables found in names(adjustVars).

glm.trt

A character specification of the right-hand side of the equation passed to the formula option of a call to glm for the estimate of the conditional probability of treatment. Ignored if SL.trt != NULL. By default set to "1", corresponding to using empirical estimates of each value of trt. The formula can include any variables found in names(adjustVars).

att

A boolean indicating whether to compute the ATT estimate, instead of treatment specific survival curves. This option only works with two levels of trt that are labeled with 0 and 1.

returnIC

A logical indicating whether to return vectors of influence curve estimates. These are needed for some post-hoc comparisons, so it is recommended to leave as TRUE (the default) unless the user is sure these estimates will not be needed later.

returnModels

A logical indicating whether to return the glm or SuperLearner objects used to estimate the nuisance parameters. Must be set to TRUE if the user plans to use timepoints to obtain estimates at times other than t0. See the documentation of timepoints for more information.

ftypeOfInterest

An input specifying what failure types to compute estimates of incidence for. The default value computes estimates for values unique(ftype). Can alternatively be set to a vector of values found in ftype.

trtOfInterest

An input specifying which levels of trt are of interest. The default value computes estimates for all of the values in unique(trt). Can alternatively be set to a vector of values found in trt.

method

A character specification of how the targeted minimum loss-based estimators should be computer, either "mean" or "hazard". The "mean" specification uses a closed-form targeted minimum loss-based estimation based on the G-computation formula of Bang and Robins (2005). The "hazard" specification uses an iterative algorithm based on cause-specific hazard functions. The latter specification has no guarantee of convergence in finite samples. The convergence can be influenced by the stopping criteria specified in the tol. Future versions may implement a closed form version of this hazard-based estimator.

bounds

A list of bounds.

verbose

A logical indicating whether the function should print messages to indicate progress.

tol

The stopping criteria when method = "hazard". The algorithm will continue performing targeting updates to the initial estimators until the empirical mean of the efficient influence function is smaller than tol. The default (1/length(ftime)) is a sensible value. Larger values can be used in situations where convergence of the algorithm is an issue; however, this may lead to large finite-sample bias.

maxIter

A maximum number of iterations for the algorithm when method = "hazard". The algorithm will iterate until either the empirical mean of the efficient influence function is smaller than tol or until maxIter iterations have been completed.

Gcomp

A logical indicating whether to compute the G-computation estimator (i.e., a substitution estimator with no targeting step). Note: theory does not support inference for the G-computation estimator if Super Learner is used to estimate failure and censoring mechanisms. Only implemented for method = "mean".

Value

Options to be passed to either mean_tmle or hazard_tmle.


benkeser/survtmle documentation built on Nov. 23, 2023, 4:45 a.m.