This function gives an image
representation of the log-likelihood
surface of a mixture (Chapter 6) of two normal densities with means \(\mu_1\)
and \(\mu_2\) unknown. It first generates the random sample associated
with the distribution.
plotmix(mu1 = 2.5, mu2 = 0, p = 0.7, n = 500, plottin = TRUE, nl = 50)
the simulated sample
the discretised representation of the log-likelihood surface
first mean
second mean
weight of the first component
number of observations
boolean variable to plot the surface (or not)
number of contours
In this case, the parameters are identifiable: \(\mu_1\) and \(\mu_2\) cannot be confused when \(p\) is not 0.5. Nonetheless, the log-likelihood surface in this figure often exhibits two modes, one being close to the true value of the parameters used to simulate the dataset and one corresponding to a reflected separation of the dataset into two homogeneous groups.
gibbsmean, hmmeantemp