calcquantile {groupcompare} | R Documentation |
Sample Quantiles
Description
Calculates the quantiles (percentiles) for a given vector of data at specified fractions.
Usage
calcquantile(x, indices, Q = seq(0.1, 0.9, 0.1), qt = 7)
Arguments
x |
Numeric vector containing the values to calculate quantiles. |
indices |
Optional; vector containing the indices for which the calculation will be performed. |
Q |
Probabilities for quantile levels. The default is |
qt |
Type of quantile calculation. Integer between |
Details
This function calculates the quantiles at specified fractions of the given data set. If qt
is 0, the hdqe
function is used.
-
0: Harrell-Davis estimator (not available in stats::quantile function).
-
1: Inverse of the empirical distribution function.
-
2: Similar to Type 1 but with averaging at discontinuities.
-
3: Empirical distribution with sampling.
-
4: Linear interpolation of the empirical distribution function.
-
5: Linear interpolation of the expectations for the order statistics.
-
6: Linear interpolation of the modes for the order statistics.
-
7: The default in the stats::quantile function.
-
8: Median-unbiased estimator.
-
9: Normal-unbiased estimator.
For the details on types, see the quantile
and hdqe
functions.
Value
Returns a numeric vector containing the calculated quantiles.
Author(s)
Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe
References
Hyndman, R. J. and Fan, Y. (1996) Sample quantiles in statistical packages, American Statistician 50, 361–365. <doi:10.2307/2684934>.
See Also
Examples
x <- rnorm(100)
calcquantile(x)
calcquantile(x, qt=9)
calcquantile(x, qt = 0)