Learn R Programming

MineICA (version 1.12.0)

plotMix: Plots an histogram and Gaussian fitted by Mclust

Description

Given a result of function Mclust applied to a numeric vector, this function draws the fitted Gaussian on the histogram of the data values.

Usage

plotMix(mc, data, nbBreaks, traceDensity = TRUE, title = "", xlim, ylim, ...)

Arguments

mc
The result of Mclust function applied to argument data
data
A vector of numeric values
nbBreaks
The number of breaks for the histogram
traceDensity
If TRUE (default) density are displayed on the y-axis, else if FALSE counts are displayed on the y-acis
title
A title for the plot
xlim
x-axis limits to be used in the plot
ylim
y-axis limits to be used in the plot
...
additional arguments for hist

Value

NULL

Details

A shapiro test p-value is added to the plot title. This function can only deal with at the most three Gaussian.

See Also

hist, Mclust

Examples

Run this code
## create a mix of two Gaussian
v <-c(rnorm(80,mean=-0.5,sd=1),rnorm(80,mean=1,sd=0.2))
## apply Mclust
mc <- Mclust(v)
## plot fitted Gaussian on histogram of v
plotMix(mc=mc,data=v,nbBreaks=30)

Run the code above in your browser using DataLab