R/06_calc_myreg_helpers_coef.R
    beta_hat.RdThis function extracts coef from mreg_fit and pads with zeros appropriately to create a named vector consistently having the following elements:
(Intercept),
avar,
cvar (this part is eliminated when cvar = NULL),
emm_ac_mreg (this part is eliminated when emm_ac_mreg = NULL).
beta_hat(mreg, mreg_fit, avar, cvar, emm_ac_mreg = NULL)A character vector of length 1. Mediator regression type: "linear" or "logistic".
Model fit object for mreg (mediator model).
A character vector of length 1. Treatment variable name.
A character vector of length > 0. Covariate names. Use NULL if there is no covariate. However, this is a highly suspicious situation. Even if avar is randomized, mvar is not. Thus, there are usually some confounder(s) to account for the common cause structure (confounding) between mvar and yvar.
A character vector of length > 0. Effect modifiers names. The covariate vector in treatment-covariate product term in the mediator model.
A named numeric vector of coefficients.