PATCH: Statistics function incorrectly computing median

Ben Abbott bpabbott at mac.com
Tue Jan 29 05:06:35 CST 2008


On Jan 29, 2008, at 2:14 AM, John W. Eaton wrote:

> On 28-Jan-2008, Ben Abbott wrote:
>
> | Here's the ChangeLog, patch,
>
> The patch failed to apply cleanly, probably because lines were wrapped
> by some mailer.  Will you please send patches as text/plain
> attachments?
>
> | and new files (I've zipped them with their directory structure in  
> place).
>
> Unzipping the file also created the following files:
>
>     6148  01-28-08 22:44   scripts/.DS_Store
>       82  01-28-08 22:44   __MACOSX/scripts/._.DS_Store
>     6148  01-28-08 22:44   scripts/statistics/.DS_Store
>       82  01-28-08 22:44   __MACOSX/scripts/statistics/._.DS_Store
>      186  01-28-08 08:44   __MACOSX/scripts/statistics/ 
> base/.___quantile__.m
>      187  01-28-08 08:46   __MACOSX/scripts/statistics/ 
> base/._prctile.m
>      188  01-28-08 08:49   __MACOSX/scripts/statistics/ 
> base/._quantile.m
>
> In the future, can you create a zip file without these extra files?
>
> Shouldn't prctile and quantile work on N-d arrays?  The Matlab docs
> state that they work along the first non-singleton dimension.
>
> jwe

John,

I've attached the patch.

Regarding the extra files, they'll not show up if I don't bother with  
the directory structure (a Mac OS X feature).

Regarding the non-singleton dimension, prctile and quantile do work  
for matrices ... but I had missed the bit about N-d arrays.

Checking to Mathworks site, that feature is rather obvious. I don't  
know how I missed it.
"Y = prctile(X,p) returns percentiles of the values in X. p is a  
scalar or a vector of percent values. When X is a vector, Y is the  
same size as p and Y(i) contains the p(i)th percentile. When X is a  
matrix, the ith row of Y contains the p(i)th percentiles of each  
column of X. For N-dimensional arrays, prctile operates along the  
first nonsingleton dimension of X."

I'll make this modification, add some more tests and ask Michael to  
compare with Matlab.

If it is acceptable, please check in the new files and I'll patch them  
when done.

Ben

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080129/60d7ee82/attachment-0002.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: statistics.patch
Type: application/octet-stream
Size: 1778 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080129/60d7ee82/attachment-0001.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080129/60d7ee82/attachment-0003.html 


More information about the Bug-octave mailing list