comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: MODE in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: MODE in IDL? [message #47104 is a reply to message #47103] Tue, 24 January 2006 19:13 Go to previous messageGo to previous message
Jonathan Greenberg is currently offline  Jonathan Greenberg
Messages: 91
Registered: November 2002
Member
David:
That is the defintion of mode -- it really surprised me this isn't built
into IDL, since its a common and basic enough statistic.

--j

"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.1e40988f4505ca03989b37@news.frii.com...
> Jonathan Greenberg writes:
>
>> I can't seem to find the function to calculate the mode of an array --
>> how
>> do I do this in IDL?
>
> I'm trying to remember back to grade school or somewhere, but
> isn't the mode the maximum of the frequency distribution. I
> remember that the mode isn't unique, because two numbers
> could have the same frequency in the sample (bimodal, I guess)
> and it is theoretically possible to have no mode (all frequencies
> are the same).
>
> But saying all that, if you have an integer array, I would
> think the mode is calculated like this:
>
> array = [1, 1, 2 , 4, 1, 3, 3, 2, 4, 5, 3, 2, 2, 1, 2, 6]
> h = Histogram(array, MIN=Min(array))
> bigfreq = Max(h)
> mode = Where(h EQ bigfreq) + Min(array)
> Print, mode
> 2
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL Quiz and Essay Contest
Next Topic: Reading DICOM images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 20:42:32 PDT 2025

Total time taken to generate the page: 0.87958 seconds