Learn R Programming

bayess (version 1.4)

plotmix: Graphical representation of a normal mixture log-likelihood

Description

This function gives an image representation of the log-likelihood surface of a mixture (Chapter 6) of two normal densities with means $mu1$ and $mu2$ unknown. It first generates the random sample associated with the distribution.

Usage

plotmix(mu1 = 2.5, mu2 = 0, p = 0.7, n = 500, plottin = TRUE, nl = 50)

Arguments

mu1
first mean
mu2
second mean
p
weight of the first component
n
number of observations
plottin
boolean variable to plot the surface (or not)
nl
number of contours

Value

sample
the simulated sample
like
the discretised representation of the log-likelihood surface

Details

In this case, the parameters are identifiable: $mu1$ and $mu2$ 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.

See Also

gibbsmean, hmmeantemp

Examples

Run this code
resumix=plotmix()

Run the code above in your browser using DataLab