Statistics function incorrectly computing median
Ben Abbott
bpabbott at mac.com
Sun Jan 6 00:14:26 CST 2008
On Jan 6, 2008, at 1:30 PM, Miguel Garcia-Blanco wrote:
> Octave 3.0.0 (i686-pc-msdosmsvc)
>
> The statistics function seems to be incorrectly computing the median:
>> x = 0:1;
>> x_stat = statistics( x );
>> x_med = x_stat( 3 );
>> x_med == median( x )
> ans = 0
>
> -Miguel
The bug appears to be buried here
> discrete_inv([0.25; 0.5; 0.75],[0:1],[1 1]/3)
> ans =
>
> 0
> 0
> 1
The correct answer would be
> ans =
> 0
> 0.5
> 1
From what I can tell, this problem only occurs when the population
has two members.
Ben
p.s. I've copied the author.
More information about the Bug-octave
mailing list