plot_EM_embedding.RdVisualize an EM fit (from EM_algorithm()) on 1D or 2D selected coordinates.
For 2D, draws arrows connecting component means in order. For 1D, draws a scatter
of posterior position vs the selected coordinate and overlays the mean curve.
plot_EM_embedding(
fit,
X,
dims = c(1, 2),
position = NULL,
use_posterior_mean = TRUE,
pch = 19,
col = "grey60",
cex = 0.7,
mu_pch = 8,
mu_col = "orange",
mu_cex = 1,
arrow_col = "orange",
arrow_lwd = 3,
arrow_len = 0.08,
line_col = "orange",
line_lwd = 2,
add = FALSE,
xlab = NULL,
ylab = NULL,
main = NULL,
...
)A fitted object returned by EM_algorithm().
Numeric matrix (n x d). The data used to fit the model.
Integer vector of length 1 or 2 indicating which coordinates (columns of X) to plot.
Optional numeric vector of length n giving x-axis "position".
If NULL, uses fit$position if present; otherwise uses posterior mean position computed as
fit$gamma %*% seq_len(K).
Logical; if TRUE (default), use posterior mean position.
If FALSE, use MAP position via max.col(fit$gamma).
Point style for data scatter.
Mean point style.
Arrow style (2D only).
Mean curve style (1D only).
Logical; if TRUE, add to existing plot.
Labels; if NULL, auto-generated.
Passed to plot() for the scatter.
Invisibly returns a list with dims, pos, mu_mat.