This function performs a fluctuation of an initial estimate of the G-computation regression at a specified time t using a call to glm (i.e., a logistic submodel) or a call to optim (if bounds are specified). The structure of the function is specific to how it is called within mean_tmle. In particular, wideDataList must have a very specific structure for this function to run properly. The list should consist of data.frame objects. The first should have all rows set to their observed value of trt. The remaining should in turn have all rows set to each value of trtOfInterest in the survtmle call. The latter will be used to obtain predictions that are then mapped into the estimates of the cumulative incidence function at t0. Currently the code requires each data.frame to have named columns for each name in names(adjustVars), as well as a column named trt. It must also have a columns named Nj.Y where j corresponds with the numeric values input in allJ. These are the indicators of failure due to the various causes before time t and are necessary for determining who to include in the fluctuation regression. Similarly, each data.frame should have a column call C.Y where Y is again t-1, so that right-censored observations are not included in the regressions. The function will fit a logistic regression with Qj.star.t + 1 as outcome (also needed as a column in wideDataList) with offset qlogis(Qj.star.t) and number of additional covariates given by length(trtOfInterest). These additional covariates should be columns in the each data.frame in wideDataList called H.z.t where z corresponds to a each unique value of trtOfInterest. The function returns the same wideDataList, but with a column called Qj.star.t added to it, which is the fluctuated initial regression estimate evaluated at the observed data points.

fluctuateIteratedMean(
  wideDataList,
  t,
  uniqtrt,
  whichJ,
  allJ,
  t0,
  Gcomp = FALSE,
  bounds = NULL,
  ...
)

Arguments

wideDataList

A list of data.frame objects.

t

The timepoint at which to compute the iterated mean.

uniqtrt

The values of trtOfInterest passed to mean_tmle.

whichJ

Numeric value indicating the cause of failure for which regression should be computed.

allJ

Numeric vector indicating the labels of all causes of failure.

t0

The timepoint at which survtmle was called to evaluate. Needed only because the naming convention for the regression if t == t0 is different than if t != t0.

Gcomp

A logical indicating whether mean_tmle was called to evaluate the G-computation estimator, in which case this function does nothing but re-label columns.

bounds

A list of bounds to be used when performing the outcome regression (Q) with the Super Learner algorithm. NOT YET IMPLEMENTED.

...

Other arguments. Not currently used.

Value

The function then returns a list that is exactly the same as the input wideDataList, but with a column named Qj.star.t added to it, which is the fluctuated conditional mean of Qj.star.t+1 evaluated at the each of the rows of each data.frame in wideDataList.