Can anyone explain averaged-inverted-cdf method in either numpy.quantiles or R's quantile ? Per either documentation, given a (sorted) container X[n], the quantile is calculated as: Q = (1-π) X[j] + π X[j+1], for a quantile input value q such that q*n falls between j and j+1. That is the generic formula.
Now, for averaged-inverted-cdf () or, equivalently, type=2 in R () the only possible values for π are: π β {0.5, 1} (Also confirmed by the referenced paper: "R. J. Hyndman and Y. Fan, βSample quantiles in statistical packages,β The American Statistician, 50(4), pp. 361-365, 1996").
So, then, how is it possible that for the dataset (container): [0.13, 1.0, 1.9 , 2.11, 9.2 ], I get the averaged-inverted-cdf quantile at input q=0.0 as being Q = 0.13? The leftmost position X[0] should never be picked because, π β 0 ("can never be 0"). So, it should either be the rightmost value (X[1] = 1.0); or the average (X[0] + X[1])/2 = 0.565
The Python code:
>>> arr1s
array([0.13, 1. , 1.9 , 2.11, 9.2 ])
>>> np.quantile(arr1s, 0.0, method = 'averaged_inverted_cdf')
0.13...and the R code:
> quantile(c(0.13, 1.0, 1.9, 2.11, 9.2), 0.001, type=2)
0.1%
0.13What am I missing?
$\endgroup$ Reset to default