Mode of a distribution, either continuous or discrete.
Arguments
- x
vector of data.
- discrete
logical;
FALSE(default) for continuous distributions,TRUEfor discrete distributions.- multi
logical;
TRUE(default) returns multiple mode values.FALSEreturns the highest peak; among equally high peaks, the one nearest NNS.gravity of the data (then the lower value), so the result is always one of the modes.
Value
Returns the mode of the distribution: a numeric vector of all modes when multi = TRUE (default), otherwise a single numeric value.
Details
The continuous mode finds the peaks of a smoothed histogram with bin width IQR / sqrt(n), peaks in the first and last bins included, and centres each peak on the mean of the observations within three bins of it, so a peak on a single value returns that value. When every gap between consecutive distinct values is wider than a bin, the data are treated as discrete-valued: the modes are the values more frequent than their neighbouring values, a run of equally frequent values counting together. discrete = TRUE instead rounds to integers and returns the most frequent integers.