[R] Question about R mode

Greg Snow Greg.Snow at imail.org
Fri Apr 16 01:07:29 CEST 2010

The mode is a well defined concept for theoretical distributions, but much less well defined when applied to data.  Some attempts at getting the mode of data actually returns a quirk of rounding rather than anything informative about the data and the distribution that it represents.  This is especially true when the data is supposed to represent and underlying continuous distribution.  If the theorized distribution is discrete (Poisson, binomial, etc.) then the mode may be more meaningful (but can still be the result of a quirk of rounding).  For discrete distributions you can just use the table function to get all the counts and look for the largest (and look for other similar values to see if your single "mode" is really meaningful).  For continuous distributions you need to decide what you really want and what level of approximation you are willing to live with and what assumptions you are willing to make (one simple approach is just look at the histogram, if there is a clear peak, then that gives you a modal range).

Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of djackson at miners.utep.edu
> Sent: Wednesday, April 14, 2010 8:55 PM
> To: r-help at r-project.org
> Subject: [R] Question about R mode
> Hello all,
> I am using R to perform certain calculations on huge amounts of data.
> In short I need a function that does the mode function, ie returns the
> most common element.  I looked at the mode function in R but it seems
> to return the type of the data element you give it.  Does such a method
> exist?  I have tried googling this to no avail as all the results lead
> me back to the mode function I do not want.
> Thanks,
> Don
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list