Computes the integrand for mediation analysis in InterXshift by combining the models for outcome given mediator and exposure (q_model), and the density of the mediator given exposure and covariates (r_model).

integrand_q_r(
  z,
  row_data,
  covars,
  w_names,
  q_model,
  r_model,
  exposure,
  mediator,
  delta,
  upper_a,
  density_type
)

Arguments

z

Numeric vector, grid points for the mediator.

row_data

Data frame, containing the data for a single observation.

covars

Character vector, names of the covariate columns in the data.

w_names

Character vector, names of the baseline covariate columns in the data.

q_model

Fitted Super Learner model, the outcome model given mediator and exposure.

r_model

Fitted Super Learner or parametric model, the mediator density given exposure and covariates.

exposure

Character, name of the exposure variable in the data.

mediator

Character, name of the mediator variable in the data.

delta

Numeric, the amount to shift the exposure variable.

upper_a

Numeric, the upper bound for the exposure variable.

density_type

Character, either "sl" for Super Learner or "parametric" for parametric models.

Value

Numeric vector, the computed values of the integrand.