Note that this function should only be used for Binary outcome models.
w_m_binaryY(
mstar_matrix,
outcome_matrix,
pistar_matrix,
pi_matrix,
p_yi_m0,
p_yi_m1,
sample_size,
n_cat
)w_m_binaryY returns a matrix of E-step weights for the EM-algorithm.
Rows of the matrix correspond to each subject. Columns of the matrix correspond
to the true mediator categories \(j = 1, \dots,\)
n_cat.
A numeric matrix of indicator variables (0, 1) for the observed
mediator M*. Rows of the matrix correspond to each subject. Columns of
the matrix correspond to each observed mediator category. Each row should contain
exactly one 0 entry and exactly one 1 entry.
A numeric matrix of indicator variables (0, 1) for the observed
outcome Y. Rows of the matrix correspond to each subject. Columns of
the matrix correspond to each observed outcome category. Each row should contain
exactly one 0 entry and exactly one 1 entry.
A numeric matrix of conditional probabilities obtained from
the internal function pistar_compute. Rows of the matrix correspond to
each subject and to each observed mediator category. Columns of the matrix
correspond to each true, latent mediator category.
A numeric matrix of probabilities obtained from the internal
function pi_compute. Rows of the matrix correspond to each subject.
Columns of the matrix correspond to each true, latent mediator category.
A numeric vector of outcome probabilities computed assuming a true mediator value of 0.
A numeric vector of outcome probabilities computed assuming a true mediator value of 1.
An integer value specifying the number of observations in
the sample. This value should be equal to the number of rows of the observed
mediator matrix, mstar_matrix.
The number of categorical values that the true outcome, M,
and the observed outcome, M*, can take.