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

extract_joint(Q_M_n_i, M1_i, M2_i, all_mediator_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.

M1_i

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

all_mediator_values

All possible combinations of M1 and M2. Used to identify which entry in Q_M_n_i that corresponds to values specified in M1_i and M2_i.

a_val

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

...

Not used