[R] Mode value

Greg Snow Greg.Snow at imail.org
Wed Sep 10 18:45:27 CEST 2008


Others showed you how to find the mode in a dataset, I just want to point out that if your data is from a continuous distribution (or near continuous), then the mode of the data is more likely to be the result of a quirk of rounding than representative of anything useful.  If the data is discrete, then the mode of the data may be meaningful, but looking at the entire table of frequencies, or a plot of them, will give you the mode information along with additional information that may help determine if that mode value is meaningful.

If you really want to make inference about the mode of a continuous distribution then you should either use something like fitdistr (from the MASS package) to fit the data to a specific distribution, then use the theory/likelihood of that distribution to find the mode, or use the density function or the logspline package to fit a density to the data (less dependent upon assumptions about the distribution) and look at the mode(s) from those estimates.

Hope this helps,

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



> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Carlos Morales
> Sent: Saturday, September 06, 2008 11:24 AM
> To: r-help at r-project.org
> Subject: [R] Mode value
>
> Hello everyone,
>
>
> I would like to know if there is any function to calculate
> the mode value, or I have to build one to do it.
>
>
> Thanks so much
> Carlos
>
>
>
>
> ______________________________________________
> 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