Value | Meaning |
---|---|
type1 | Discontinuous sample quantileInverse of empirical distribution function. |
type2 | Similar to type1, but averages at discontinuities. |
type3 | SAS definition: nearest even order statistic. |
type4 | Continuous sample quantileLinear interpolation of the empirical cdf. |
type5 | A piece-wise linear function hwere the knots are the values midway through the steps of the empirical cdf. Popular amongst hydrologists. |
type6 | Used by Minitab and by SPSS. |
type7 | This is used by S and is the default for R. |
type8 | The resulting quantile estimates are approximately median-unbiased regardless of the distribution of the input. Preferred by Hyndman and Fan (1996). |
type9 | The resulting quantile estimates are approximately unbiased for the expected order statistics of the input is normally distributed. |
where x$(SUBSCRIPT j) is the jth order statistic. gamma is a function of j = floor(np + m) and g = np + m - j where n is the sample size, p is the probability, and m is a constant determined by the quantile type.
Type | m | gamma |
---|---|---|
Discontinuous sample quantile | ||
Continuous sample quantile |
References: Hyndman, R. J. and Fan, Y. (1996) Sample quantiles in statistical packages, American Statistician 50, 361--365. 10.2307/2684934.
Algorithms used to calculate the quantile of an input x at probability p.
These algorithms match the same provided in R's (as of version 3.6.2) quantile function. In turn, these were discussed in Hyndman and Fan (1996).
All sample quantiles are defined as weighted averages of consecutive order statistics. For each quantileAlgo, the sample quantile is given by (using R's 1-based indexing notation):
(1 - gamma) * x$(SUBSCRIPT j) + gamma * x$(SUBSCRIPT j + 1)