Learn R Programming

bayess (version 1.6)

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 \(\mu_1\) and \(\mu_2\) 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)

Value

sample

the simulated sample

like

the discretised representation of the log-likelihood surface

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

Details

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.

See Also

gibbsmean, hmmeantemp

Examples

Run this code
resumix=plotmix()

Run the code above in your browser using DataLab