EM-Algorithm Function for Estimation of the Misclassification Model
em_function(param_current, obs_Y_matrix, X, Z, sample_size, n_cat)
em_function
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\). The \(\gamma\) vector is obtained from the matrix form.
In matrix form, the gamma parameter matrix rows
correspond to parameters for the Y* = 1
observed outcome, with the dimensions of Z
.
In matrix form, the gamma parameter matrix columns correspond to the true outcome 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 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 design matrix for the true outcome mechanism.
A numeric design matrix for the observation mechanism.
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, Y
,
and the observed outcome, Y*
can take.