plot_GMM: Plots Mixture Components from Gaussian Mixture Models

Description Usage Arguments Details References Examples

View source: R/plot_GMM.R

Description

Generates a plot of data densities with overlaid mixture components from a Gaussian mixture model (GMM)

Usage

1
plot_GMM(m, k=NULL)

Arguments

m

An object of class mixEM corresponding with the fit GMM

k

The number of components specified in the GMM, m

Details

Uses ggplot2 graphics to plot data densities with overlaid components from mixEM objects, which are GMM's fit using the mixtools package.

Note: Users must enter the same component value, k, in the plot_GMM function, as that which was specified in the original GMM specification (also k in mixtools).

References

Benaglia, T., Chauveau, D., Hunter, D. and Young, D., 2009. mixtools: An R package for analyzing finite mixture models. Journal of Statistical Software, 32(6), pp.1-29.

Wickham, H., 2016. ggplot2: elegant graphics for data analysis. Springer.

Examples

1
2
3
4
set.seed(235)
mixmdl <- mixtools::normalmixEM(faithful$waiting, k = 2)

plot_GMM(mixmdl, 2)

Example output

*Attention*: `plotGMM` is no longer actively developed. Instead, use the expanded package, `plotmm`. Thanks!
number of iterations= 30 

plotGMM documentation built on July 8, 2020, 7:26 p.m.