This function generates a plot showing the parameter estimates over the course of the EM algorithm's iterations. The plot visualizes the convergence of each parameter to its final estimate. If the true values of the parameters are provided, they will be shown as dashed lines on the plot for comparison.
Arguments
- em_par
A list or data frame containing the EM algorithm's iteration results. Specifically, it should include the estimated parameters (`par_re`), with rows representing iterations and columns representing parameters.
- par
A vector of true parameter values (optional) to be plotted as horizontal dashed lines for comparison.
- ncol
Integer specifying the number of columns in the facet grid layout. The plot will display each parameter in its own facet.
- ture_value
Logical value (`TRUE` or `FALSE`). If `TRUE`, the true parameter values will be plotted as dashed horizontal lines. If `FALSE`, the true values will not be shown.
- orders
A vector of parameter names in the desired order for the facets.
- f_names
A vector of labels to be used for each parameter when facetting the plot.
Details
The function uses `ggplot2` to create a line plot of the parameter estimates (`par_re`) at each iteration, with an optional comparison to the true parameter values (`par`). The data is reshaped using `pivot_longer` for easier plotting, and the function provides customization options for the plot's appearance.
