Question

for some reason i cannot make octave return quantiles. Example:

a = 1:15;
quantile(a)
ans= 1 2 3 4 5 6 ... 15

While i would expect something like:

ans= 1.0  4.5  8.0 11.5 15.0

The same happens if i try prctile(a). So, what is the problem? Regards, Helbo

Was it helpful?

Solution 2

Octave was trying to calculate the values for each column. Because your input is a row vector, each column has only 1 element, hence the weird behaviour. You can work around this by specifying the dimension (third input argument), or passing the a column vector (use x(:)).

Apparently this was Matlab old behaviour but this has since changed, and Octave will now use the first non-singleton dimension (see bug #40736). If you're using the development version (not yet released) that will work fine:

quantile (1:15)
ans =

    1.0000    4.2500    8.0000   11.7500   15.0000

OTHER TIPS

a = (1:15)';
quantile(a)
ans =

    1.0000
    4.2500
    8.0000
   11.7500
   15.0000
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top