On Aug 20, 4:56 pm, David Fanning <n...@dfanning.com> wrote:
> te...@atmsci.msrc.sunysb.edu writes:
>> Hi, Suppose data is something simple like:
>
>> data=[2,3,5,7,7,10,11,11,12,15,16,17,17]
>
>> I get a 75th quartile of 11.0. Shouldn't I get around 15?
>
> JD will have to explain the difference between BINSIZE
> and NBINS to us again. (And I think he is in China for
> a couple of weeks.) But I got strange results with my
> HISTOGRAM method, too. Here is a slightly revised program:
>
> data=[2,3,5,7,7,10,11,11,12,15,16,17,17]
> ;box plot needs min, max, median which are straight forward:
>
> minVal = min(data)
> maxVal = max(data)
> medianVal = median(data,/even)
>
> ; Find the quartiles.
> h = Histogram(data, NBINS=4, REVERSE_INDICES=ri, $
> MIN=minVal, MAX=maxVal)
> qtr_25th = Median(data[ri[ri[0]:ri[2]-1]])
> qtr_75th = Median(data[ri[ri[2]:ri[4]-1]])
>
> Print, minVal, maxVal, medianVal, qtr_25th, qtr_75th
> END
>
> And the result I get with the new data:
>
> 2 17 11.0000 7.00000 16.0000
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks,
I think I will go with yours!
Howie
|