Function is for cases with \(Y \sim Bernoulli\) and with no interaction term in the outcome mechanism.
EM_function_bernoulliY(
param_current,
obs_mediator,
obs_outcome,
X,
Z,
c_matrix,
sample_size,
n_cat
)EM_function_bernoulliY returns a numeric vector of updated parameter
estimates from one iteration of the EM-algorithm.
A numeric vector of regression parameters, in the order
\(\beta, \gamma, \theta\). The \(\gamma\) vector is obtained from the matrix form.
In matrix form, the gamma parameter matrix rows
correspond to parameters for the M* = 1
observed mediator, with the dimensions of Z.
In matrix form, the gamma parameter matrix columns correspond to the true mediator categories
\(j = 1, \dots,\) n_cat. The numeric vector gamma_v is
obtained by concatenating the gamma matrix, i.e. gamma_v <- c(gamma_matrix).
A numeric vector of indicator variables (1, 2) for the observed
mediator M*. There should be no NA terms. The reference category is 2.
A vector containing the outcome variables of interest. There
should be no NA terms.
A numeric design matrix for the true mediator mechanism.
A numeric design matrix for the observation mechanism.
A numeric matrix of covariates in the true mediator and outcome mechanisms.
c_matrix should not contain an intercept and no values should be NA.
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, X or Z.
The number of categorical values that the true outcome, M,
and the observed outcome, M* can take.