Learn R Programming

MineICA (version 1.12.0)

plotAllMix: Plots the Gaussian fitted by Mclust on several numeric vectors

Description

Given a result of function Mclust applied on several numeric vectors, this function plots the fitted Gaussian on their histograms.

Usage

plotAllMix(mc, A, nbMix = NULL, pdf, nbBreaks = 20, xlim = NULL)

Arguments

mc
A list consisting of outputs of function Mclust applied to each column of A, if this argument is missing Mclust is applied by the function.
A
A data.frame of dimensions 'samples x components'.
nbMix
The number of Gaussian to be fitted.
nbBreaks
The number of breaks for the histogram.
xlim
x-axis limits to be used in the plot.
pdf
A pdf file.

Value

A list of Mclust results.

Details

This function can only deal with at the most three Gaussian

See Also

plotMix, hist, Mclust

Examples

Run this code
A <-matrix(c(c(rnorm(80,mean=-0.5,sd=1),rnorm(80,mean=1,sd=0.2)),rnorm(160,mean=0.5,sd=1),
           c(rnorm(80,mean=-1,sd=0.3),rnorm(80,mean=0,sd=0.2))),ncol=3)
## apply function Mclust to each column of A
mc <- apply(A,2,Mclust)
## plot the corresponding Gaussians on the histogram of each column
plotAllMix(mc=mc,A=A)
## apply function Mclust to each column of A, and impose the fit of two Gaussian (G=2)
mc <- apply(A,2,Mclust,G=2)
## plot the corresponding Gaussians on the histogram of each column
plotAllMix(mc=mc,A=A)
## When arg 'mc' is missing, Mclust is applied by the function
plotAllMix(A=A)

Run the code above in your browser using DataLab