plot_cut_point: Plots Cut Point from Gaussian Mixture Models

Description Usage Arguments Details References Examples

View source: R/plot_cut_point.R

Description

Returns a plot of the data density (histogram) with an overlaid cut point generated by a Gaussian mixture model

Usage

1
plot_cut_point(m, plot = TRUE, color = c("grayscale", "amerika", "wesanderson"))

Arguments

m

An object of class mixEM corresponding with the fit GMM

plot

A logical argument for generating the plot. If FALSE, only the cut point value from the GMM is returned. If TRUE, histogram with the overlaid cut point is returned. Default is set to TRUE.

color

A vector of color options including "amerika" (from package amerika), "wesanderson" (from package wesanderson), and "grayscale", which is the default option.

Details

Gaussian mixture models are often used to derive cut points, or lines of separation between clusters in feature space (See Benaglia et al. 2009 for more). The plot_cut_point function plots data densities with the overlaid cut point (the mean of the calculated mu) from mixEM objects, which are GMM's fit using the mixtools package.

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.

Ram, K., and Wickham, H. 2015. wesanderson: a Wes Anderson palette generator. R package version 0.3.

Examples

1
2
3
4
5
mixmdl <- mixtools::normalmixEM(faithful$waiting, k = 2)

plot_cut_point(mixmdl, plot = TRUE, color = "amerika") # returns plot, amerika
plot_cut_point(mixmdl, plot = TRUE, color = "wesanderson") # returns plot, wesanderson
plot_cut_point(mixmdl, plot = FALSE) # returns only the cut point value from the GMM

Example output

*Attention*: `plotGMM` is no longer actively developed. Instead, use the expanded package, `plotmm`. Thanks!
number of iterations= 21 
Registered S3 method overwritten by 'wesanderson':
  method        from   
  print.palette amerika
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
[1] 67.35299

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