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

Home » Public Forums » archive » Q: Quantil calculation 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: Q: Quantil calculation in IDL? [message #17516 is a reply to message #17379] Mon, 18 October 1999 00:00 Go to previous messageGo to previous message
James Tappin is currently offline  James Tappin
Messages: 54
Registered: December 1995
Member
Joerg Mosthaf wrote:
> Hi,
> I have been searching the help files and David Fannings great book, but I can't
> find a way to calculate 25%- and 75%-quantils. Unfortunately I don't know the
> english name for this so let me explain: A 75%-quantil is like the median, but
> with 75% instead of 50% i.e. the number in a data spread, that 75% of all
> data points are less or equal to. Is there a way to do this fast on an
> 256x256 array? I need it to cut off noise at a specific level and to get a
> reliable min/max value, not including data spikes. I am probably overlooking
> something very easy, but I just couldn't find it.

It's not wondrously efficient. But here is a routine that I wrote that will
find arbitrary fractiles of an array (N.B. it takes fractions rather than
percentages). It could be improved by doing a floor and a ceil and
interpolating rather than just a round.

CUT HERE -- fractile .pro
function Fractile, x, frac

;+
; FRACTILE
; Return the requested fractile of the input data.
;
; Usage:
; fr = fractile(x, frac)
;
; Return:
; fr <input> The requested fractile.
;
; Arguments:
; x most input The array whose fractile(s) are to be
; returned
; frac float input The fractile(s) to return.
;
; Restrictions:
; The input data must be a SORTable array (i.e. not complex,
; string or structure).
;
; Example:
; To find the interquartile range of a data set, try:
; q = fractile(data, [.25,.75])
; iqr = q(1)-q(0)
;
; History:
; Original: 26/9/95; SJT
;-

if (n_params() ne 2) then message, 'Incorrect number of arguments'

n = n_elements(x)
i = sort(x)

f = round(frac*n)

return, x(i(f))

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Velocity vectors on maps
Next Topic: DAY OF YEAR

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

Current Time: Wed Oct 08 19:21:44 PDT 2025

Total time taken to generate the page: 0.00389 seconds