Statistics function incorrectly computing median

Ben Abbott bpabbott at mac.com
Sat Jan 26 10:37:19 CST 2008


On Jan 26, 2008, at 6:39 AM, Miguel Garcia-Blanco wrote:

> My tests (using 40 samples with 6 observations ~N(0,100)) indicate
> everything seems to be okay, except quantile.m with METHOD = 3: For  
> six
> observations, the 3rd quartile should be the 4th order statistic.  
> Currently
> returns the 5th order statistic.
>
> -Miguel

I struggled quite a bit with #3. To be honest, I had little hope it  
was working properly. The part below was added to obtain agreement  
with R in several cases.

--------------------------------------------
----- from __quantile__.m, lines 92:96 -----
--------------------------------------------
   if (x(k(q)) <= 0.5)
     inv(k(q)) = v(find(dx == min(dx), 1, "first"));
   else
     inv(k(q)) = v(find(dx == min(dx), 1, "last"));
   endif
--------------------------------------------

I'm skeptical that part should be there. Any idea on what the proper  
algorithm for #3 might look like?

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080126/855a0fdd/attachment.html 


More information about the Bug-octave mailing list