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,
returnModels = FALSE, verbose = FALSE, gtol = 0.001, ...)
An object of class data.frame
. Must have named column
trt
.
An object of class data.frame
that will be used
either as the data
argument in a call to glm
or as the
X
object in a call to SuperLearner
.
A character formula for the right-hand side of formula
in a call to glm
. See ?survtmle
for more documentation.
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.
A valid specification of the SL.library
option of a call
to SuperLearner
. See ?survtmle
for more documentation.
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.
A boolean indicating whether fitted model objects should be returned.
A boolean passed to the verbose
option of the call to
SuperLearner
.
The truncation level of predicted trt probabilities to handle positivity violations.
Other arguments. Not currently used
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