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

Home » Public Forums » archive » Re: Histogram & Cumulative Distribution Functions
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: Histogram & Cumulative Distribution Functions [message #40744 is a reply to message #40743] Fri, 27 August 2004 16:04 Go to previous message
Justin[3] is currently offline  Justin[3]
Messages: 8
Registered: November 2003
Junior Member
To get the CDF from a (discrete) PDF use the TOTAL function with the
CUMULATIVE keyword:

So if h is the output of HISTO then:
cumul = TOTAL(h, /CUMULATIVE)
tot = TOTAL(FLOAT(h))
pdf = cumul/tot

To find the 95th percentile use VALUE_LOCATE on the pdf to get the index of
the array element closest to 0.95

index = VALUE_LOCATE(pdf, 0.95)

If 'l' contains the histo locations then your 95th percentile is at:
l[index]

Make sure you have enough bins in the histogram otherwise the percentile
value can be coarse. You could even create a new histogram (just for the
cdf calculation) with nbins >= number of data points to give an accuarate
percentile value.

Hope this helps,

Justin
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Gold Medal Bug in IDL arithmetic?
Next Topic: Re: Gold Medal Bug in IDL arithmetic?

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

Current Time: Tue Dec 02 18:45:12 PST 2025

Total time taken to generate the page: 0.00248 seconds