Hi,
I wonder whether the behavior of the quantile() function in cases where
p < 1/(n+1) is optimal.
Currently, things like quantile({-1; 1}, 0.1) return NA, because 0.1 <
rows({-1; 1}). (See the definition in the quantile reference, here
(n+1)*p = 3*0.1 = 0.3, of which the integer part is zero, and there
exists no zero-th element in the ordered data vector.)
Given that quantiles can be defined in different ways, this is not
wrong. However, one could also use the minimum value in these cases.
This would correspond to a quantile definition where a fraction p of the
values is smaller *or equal to* the relevant quantile.
See also the practice in other software, for example the repeated phrase
"When p < 1 / (N+1), use x1" in the following software survey table:
http://en.wikipedia.org/wiki/Quantile#Estimating_the_quantiles_of_a_popul...
So my bottom line is: quantile() should always return something useful
instead of NA.
Thanks,
sven