Function written in C++ for estimating the parameters of the model
via Expectation Maximization (EM Algorithm).
Usage
EM_algo_c(
obs_pattern_shape,
obs_pattern_frq,
obs_internal_count,
categorical_levels,
random_starts,
max_iterations,
rel_convergence,
con_step_size,
con_random_starts,
con_max_iterations,
con_rel_convergence,
fast,
trace,
con_trace
)Arguments
- obs_pattern_shape
Matrixcontaining the unique patterns found in the data. Ideally this matrix is generated by the functionget_patterns().- obs_pattern_frq
Vectorcontaining the frequencies of the patterns. Ideally it is generated by the the functionget_patterns().- obs_internal_count
Matrixcontaining the relative frequencies of each category within each pattern. Ideally this matrix is generated by the functionget_patterns().- categorical_levels
Vectorcontaining all possible categories of the content analysis.- random_starts
Integerfor determining how often the algorithm should restart with randomly chosen values for the Assignment Error Matrix and the categorical sizes.- max_iterations
Integerfor determining the maximum number of iterations for each random start.- rel_convergence
Doublefor determining the convergence criterion. The algorithm stops if the relative change is smaller than this criterion.- con_step_size
Doublefor specifying the size for increasing or decreasing the probabilities during the condition stage of estimation. This value should not be less than 1e-3.- con_random_starts
Integerfor the number of random starts within the condition stage.- con_max_iterations
Integerfor the maximum number of iterations during the condition stage.- con_rel_convergence
Doublefor determining the convergence criterion during condition stage. The algorithm stops if the relative change is smaller than this criterion.- fast
BoolIfTRUEa fast estimation is applied during the condition stage. This option ignores all parameters beginning with "con_". IfFALSEthe estimation described in Berding and Pargmann (2022) is used. Default isTRUE.- trace
TRUEfor printing progress information on the console.FALSEif this information should not be printed.- con_trace
TRUEfor printing progress information on the console during estimations in the condition stage.FALSEif this information should not be printed.
Value
Function returns a list with the estimated parameter sets for
every random start. Every parameter set contains the following components:
- log_likelihood
Log likelihood of the estimated solution.
- aem
Estimated Assignment Error Matrix (aem). The rows represent the true categories while the columns stand for the assigned categories. The cells describe the probability that a coding unit of category i is assigned to category j.
- categorial_sizes
Vectorof estimated sizes for each category.- convergence
If the algorithm converged within the iteration limit
TRUE.FALSEin every other case.- iteration
Number of iterations when the algorithm was terminated.