[R] Re: How to get mode (the most frequent value in distribution)?

Vito Ricci vito_ricci at yahoo.com
Fri Nov 12 13:51:02 CET 2004


Hi Gregor,

if you have a continous distribution is rather
difficult that the same value is repeated many times.
In this case I believe you could not find  the mode
(the most frequent value in distribution) as your
distribution is continous, but only the modal
class/interval (the interval of the distribution
having the most frequency).

See this example:

> set.seed(13)
> x<-rnorm(100)
> xcut<-cut(x, breaks=c(-4,-3,-2,-1,0,1,2,3,4))
> table(xcut)
xcut
(-4,-3] (-3,-2] (-2,-1]  (-1,0]   (0,1]   (1,2]  
(2,3]   (3,4] 
      0       1      19      33      30      17      
0       0 
> max(table(xcut))
[1] 33

the modal class/interval is (-1,0].

I hope I give a little help.
Best
Vito

You wrote:

Hello!

I have a continous distribution and would like to get
mode  (the most 
frequent value in distribution). I easily found mean,
median and other 
basic thing but not mode function. Can anyone help?

I know there my might be problems with multiple modes,
but still I think 
that there should be a mode function in R.

Please send mail to R-help list and me, so I can get
response faster.

Thank you!

-- 
Lep pozdrav / With regards,
     Gregor GORJANC

=====
Diventare costruttori di soluzioni
Became solutions' constructors

"The business of the statistician is to catalyze 
the scientific learning process."  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml




More information about the R-help mailing list