Likelihood Function for Normal Outcome Mechanism with a Binary Mediator
theta_optim.RdLikelihood Function for Normal Outcome Mechanism with a Binary Mediator
Arguments
- param_start
A numeric vector or column matrix of starting values for the \(\theta\) parameters in the outcome mechanism and \(\sigma\) parameter. The number of elements in
param_startshould be equal to the number of columns ofx_matrixandc_matrixplus 2 (ifinteraction_indicatorisFALSE) or 3 (ifinteraction_indicatorisTRUE). Starting values should be provided in the following order: intercept, slope coefficient for thex_matrixterm, slope coefficient for the mediatormterm, slope coefficient for first column of thec_matrix, ..., slope coefficient for the final column of thec_matrix, and, optionally, slope coefficient forxm). The final entry should be the starting value for \(\sigma\).- m
A vector or column matrix containing the true binary mediator or the E-step weight (with values between 0 and 1). There should be no
NAterms.- x
A vector or column matrix of the predictor or exposure of interest. There should be no
NAterms.- c_matrix
A numeric matrix of covariates in the true mediator and outcome mechanisms.
c_matrixshould not contain an intercept and no values should beNA.- outcome
A vector containing the outcome variables of interest. There should be no
NAterms.- sample_size
An integer value specifying the number of observations in the sample. This value should be equal to the number of rows of the design matrix,
XorZ.- n_cat
The number of categorical values that the true outcome,
M, and the observed outcome,M*can take.