Function to evaluate the canonical gradient of the indirect effect through M2 at a given set of estimated nuisance parameters and for each observation.

evaluate_eif_indirect_M2(
  Y,
  A,
  M1,
  M2,
  Qbar,
  Q_M,
  Qbarbar,
  gn,
  a,
  a_star,
  all_mediator_values,
  ...
)

Arguments

Y

The outcome

A

The treatment

M1

First mediator

M2

Second mediator

Qbar

Outcome regression list

Q_M

Mediator distribution list

Qbarbar

A list; needs to have entries named M1_M2_a and M1_star_M2_star_a_star corresponding to, respectively, the outcome regression under A = a, marginalized with respect to joint mediator distribution given C and A = a, and the outcome regression under A = a_star, marginalized with respect to the joint mediator distribution given C and A = a_star.

gn

List of mediator values

a

Treatment value

a_star

Referent treatment value