Function to estimate outcome regression as a function of A, C, M1, and M2. Because later we will need to marginalize these estimates over estimated distributions of M1 and M2, the output includes the predicted value for each C_i, i = 1, ..., n and for every value of A in a_0. The output is formatted as an n-length list where there is one entry for each observation. This entry includes a list of predicted values under each treatment Qbar_a_0, which is itself a list with a vector of predictions for each value of a_0. Also included is an entry called which_M1_obs, which indicates rows of the all_mediator_values that correspond to this observation's observed value of M1 and M2. Similarly, there is a vector which_M2_obs, and also a vector which_M1_M2_obs, which indicates the row of all_mediator_values that corresponds to this observation's observed value of BOTH M1 and M2.

estimate_Qbar(
  Y,
  A,
  M1,
  M2,
  C,
  DeltaA,
  DeltaM,
  SL_Qbar,
  glm_Qbar = NULL,
  a_0,
  stratify,
  family,
  verbose = FALSE,
  return_models = FALSE,
  valid_rows,
  all_mediator_values,
  ...
)

Arguments

Y

A vector of continuous or binary outcomes.

A

A vector of binary treatment assignment (assumed to be equal to 0 or 1).

M1

A vector of mediators.

M2

A vector of mediators.

C

A data.frame of named covariates.

DeltaA

Indicator of missing treatment (assumed to be equal to 0 if missing 1 if observed).

DeltaM

Indicator of missing outcome (assumed to be equal to 0 if missing 1 if observed).

SL_Qbar

A vector of characters or a list describing the Super Learner library to be used for the outcome regression.

glm_Qbar

A character describing a formula to be used in the call to glm for the outcome regression.

a_0

A list of fixed treatment values

stratify

A boolean indicating whether to estimate the outcome regression separately for observations with A equal to 0/1 (if TRUE) or to pool across A (if FALSE).

family

A character passed to SuperLearner

verbose

A boolean indicating whether to print status updates.

return_models

A boolean indicating whether to return model fits for the outcome regression, propensity score, and reduced-dimension regressions.

valid_rows

A list of length cvFolds containing the row indexes of observations to include in validation fold.

all_mediator_values

All combinations of M1 and M2

...

Additional arguments (not currently used)