[R] Computing the mode
spencer.graves at pdf.com
Tue Feb 24 13:12:17 CET 2004
The problem is that 'the statistic "mode" of a sample' has no
clear definition. If the distribution is highly discrete, then the
following will do the job:
> X <- rpois(11,1)
> (nX <- table(X))
0 1 2 3
4 4 2 1
 "0" "1"
However, if the data are continuous with no 2 numbers exactly
equal, then the "mode" depends on the procedure, e.g., the specific
selection of breakpoints for a histogram. If you insist on finding
something, you can try "www.r-project.org" -> search -> "R site search"
for something like ""nonparametric density estimation" and / or "kernel
hope this helps.
p.s. This has been discussed recently on this list, but I could
not easily find it in the archives.
Aurora Torrente wrote:
> Hi all,
> I think this question could be quite trivial, but I can´t find out the
> solution... How can you compute the statistic "mode" of a sample, in
> case it exists (as mode() returns the mode of an object)? I tried
> help.search("mode") but I couldn't find a clue...
> Any help would be much appreciated. Regards,
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help