Helper function for extracting marginal distributions at particular values of the mediator.

extract_marginal(
  Q_M_n_i,
  mediator = "M1",
  M_i,
  unique_M_values,
  a_val = "a_star",
  ...
)

Arguments

Q_M_n_i

An entry in the Q_M_n list, where the first entry in the list corresponds to mediator distributions under a_star; the second entry in the list corresponds to mediator distributions under a. In each of these lists, we have the joint of M1,M2; the marginal of M1; and the marginal of M2.

mediator

Which mediator are you interested in extracting the marginal of? Possible values are "M1" and "M2".

M_i

The particular value at which you are interested in evaluating the marginal density. Note that the general idea is to mapply over this function to extract the marginal under each observed value of C and extract the marginal distribution at the corresponding value of e.g., M1.

unique_M_values

The unique values that the selected mediator can assume. Recall that the ordering of the marginal entries in Q_M_n_i is in this order.

a_val

Which treatment are you interested in extracting the marginal under? Possible values are "a_star" and "a"

...

Not used