plot_cut_point {plotmm} | R Documentation |
Tidy Visualization of a Cut Point from a Mixture Model
Description
Returns a plot of the data density (histogram) with an overlaid cut point generated by the fit mixture model
Usage
plot_cut_point(m, plot = TRUE, color = c("grayscale", "amerika", "wesanderson"))
Arguments
m |
An object of class |
plot |
Logical 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 |
Details
Mixture models can be used to derive cut points separating clusters via soft assignment (See Benaglia et al. 2009 for more). plot_cut_point()
plots data density with an overlaid cut point (the mean of the calculated mu
) from mixEM
objects via mixtools
. Note, this function is in its infancy, and at present only works in the limited context of 2-component Gaussian mixture models with equal priors and equal variances. Development for more complex cases is in process.
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
if(require(mixtools)){
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