View source: R/mexmsilhouette.R
mexmsilhouette | R Documentation |
Produces a graph with several excess mass plots allowing for different maximal numbers of modes/ cut off values.
mexmsilhouette(xdata, M = 1:3, CutOff = c(1,2,5), steps = 30, Lambda = NULL, col = FALSE, rug = TRUE, rdata = FALSE)
xdata |
data in form of a vector |
M |
vector containing the max. number of modes |
CutOff |
vector which determines the cut off values and hence the appearance of the graph |
steps |
number of different λs which are calculated / drawn |
Lambda |
allows to specify an own vector of λs which is drawn in the graph |
col |
lines get colored in purple (em > 0.75), green (0.75 ≥ em > 0.5), turquoise (0.5 ≥ em > 0.25), blue (0.25 ≥ em > 0.05) and black (0.05 ≥ em) |
rug |
draws a rug plot at the bottom of the graph |
rdata |
a numerical output is returned |
CutOff should not be set too small or too large, as this results in meaningless graphs.
Always a graph with multiple plots is produced. Each column contains another maximal number of modes and each row another CutOff factor.
Setting rdata=TRUE numerical results are returned in form of a list. If the number of modes and the CutOff parameter contain just one element, the output of "mexmsilhouette" and "exmplot" are equal.
Otherwise we can distinguish between two cases. First Lambda is not specified, hence the list is four-dimensional. The first element determines the CutOff value of the data by using the sorted CutOff vector (using the plot, this means the row in which the graph is shown). The second element specifies the maximal number of modes by using the sorted mode vector (again using the plot, this means the column of the plot). The third element selects the λ of the graph. For each plot and each λ, the following information is stored: the value of λ, the λ-clusters and the excess mass vector. Using the default setting [2,2,5,2] shows the λ-clusters of the fifth smallest λ of the CutOff=2-M=2-plot.
If Lambda is declared manually, the list is three-dimensional. Hence, the first argument denotes the maximal number of modes (the column of the graph). The second argument indicates the λ by the position held by it in the Lambda vector. As in "exmplot" only two information are shown. The λ-clusters ([,,1]) and the vector of excess mass ([,,2]), as the value of λ is known.
Marc-Daniel Mildenberger mildenberger.stat@web.de, based on earlier code from Dr. Guenther Sawitzki gs@statlab.uni-heidelberg.de
Muller, D. W. and Sawitzki, G., 09.1991, "Excess Mass Estimates and Tests for Multimodality", Journal of the American Statistical Association , Vol. 86, No. 415, pp. 738–746, http://www.jstor.org/stable/2290406
excessm, exmplot, exmsilhouette
library(MASS) attach(geyser) ##calculating excess mass plots for duration of 'Old Faithful Geyser', ##specifying CutOff and number of steps manually mexmsilhouette(duration, CutOff=c(1,2), steps=60) ##Allowing for three different maximal number of modes ##and CutOff factors as well as color. ##The rug plot is omitted and numerical data is requested. res=mexmsilhouette(duration, M=c(2,3,7), CutOff=c(0.8,1,2), col=TRUE, rug=FALSE, rdata=TRUE) ##Lambda is specified, color is set to true, numerical data is requested L=seq(.01,.25,0.005) res=mexmsilhouette(duration, M=c(2,3,4), Lambda=L, col=TRUE, rdata=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.