Statistics function incorrectly computing median
Miguel Garcia-Blanco
miguel.01 at ihug.com.au
Mon Jan 21 08:35:42 CST 2008
> In the octave scripts, the routines take samples and sample probabilities
> as inputs.
>
> Thus x = [1, 1, 2, 3] & p = [.25 .25 .25 .25] is equivalent to x = [1, 2,
> 3] & p = [0.5, 0.25, 0.25].
>
> As a result, some of the algorithms are not applicable to the
> architecture of octave's present statistical functions.
>
I think you may have misunderstood what P is. P is *not* the probability
distribution for X. P is a scalar or a vector of cumulative probability
values for determining the quantiles (e.g., P = 0.5 will cause the median to
be output). Try this example: X = rand(1, 1000); P = [0.1, 0.3, 0.95];
(You'll have to use 100*P with MATLAB's prctile function.)
-Miguel
More information about the Bug-octave
mailing list