This function computes the conditional probability of having trt for each specified level either using glm or SuperLearner. Currently, only two unique values of treatment are acceptable. By default the function will compute estimates of the conditional probability of trt == max(trt) and compute the probability of trt == min(trt) as one minus this probability.

estimateTreatment(
  dat,
  adjustVars,
  glm.trt = NULL,
  SL.trt = NULL,
  cvControl,
  returnModels = FALSE,
  verbose = FALSE,
  gtol = 0.001,
  ...
)

Arguments

dat

An object of class data.frame. Must have named column trt.

adjustVars

An object of class data.frame that will be used either as the data argument in a call to glm or as X in a call to SuperLearner.

glm.trt

A character formula for the right-hand side of the formula in a call to glm. See the documentation of survtmle for information. Alternatively, this could be an object of class glm (as in calls to this function via timepoints), in which case predictions are obtained using this object with no new fitting.

SL.trt

A specification of the SL.library option of a call to SuperLearner. See the documentation of survtmle for more information. Alternatively, this could be an object of class SuperLearner (as in calls to this function via timepoints), in which case predictions are obtained using this object with no new fitting.

cvControl

A list providing control options to be fed directly into calls to SuperLearner. This should match the contents of SuperLearner.CV.control exactly. For details, consult the documentation of the SuperLearner package. This is passed in from mean_tmle or hazard_tmle via survtmle.

returnModels

A logical indicating whether fitted model objects should be returned.

verbose

A logical passed to the verbose option of the call to SuperLearner.

gtol

The truncation level of predicted trt probabilities to handle positivity violations.

...

Other arguments. Not currently used

Value

dat The input data.frame object with two added columns corresponding with the conditional probability (given adjustVars) of trt==max(trt) and trt==min(trt).

trtMod If returnModels = TRUE, the fitted glm or SuperLearner object. Otherwise, NULL