Learn R Programming

wrMisc (version 1.5.1)

stableMode: Estimate mode (most frequent value)

Description

Estimate mode (ie most frequent value). The argument method allows to choos among the so far 3 different methods available. If 'denisty' is chosen, the most dense region of sqrt(n) values will be chosen; if 'binning', the data will be binned (like in histograms) via rounding to a user-defined number of significant values ('rangeSign'). If method is set to 'BBmisc', this function will use computeMode() from package BBmisc.

Usage

stableMode(
  x,
  method = "binning",
  histLike = NULL,
  rangeSign = 1:6,
  nCl = 50,
  callFrom = NULL,
  silent = FALSE
)

Arguments

x

numeric vector

method

(character) There are 3 options : 'BBmisc', 'binning' and 'density'; If 'binning' the function will search context dependent, ie like most frequent class of histogram. Using this mode the search will be refined if either 80 percent of values in single class or >50 percent in single

histLike

(logical) depreciated, please use argument method instead

rangeSign

(integer) only used when method='binning': range of numbers used as number of significant values

nCl

(integer) only used when method='binning': defines the number of classes used, very 'critical' parameter, may change results in strong way !! Note: higher values for 'nCl' will finally loose advantage of histLike-type search of mode !

callFrom

(character) allow easier tracking of message(s) produced

silent

(logical) suppress messages

Value

mode value (numeric)

See Also

cut, hist

Examples

Run this code
# NOT RUN {
set.seed(2012); dat <- round(c(rnorm(50),runif(100)),3)
stableMode(dat)
# }

Run the code above in your browser using DataLab