QuantileMethod

Selects the algorithm used to compute quantiles and percentiles from sample data.

There are nine standard estimation methods defined by Hyndman and Fan (1996), numbered HF1 through HF9. Each method uses a different formula to map a probability to a position in the sorted data, and they differ in how they handle positions that fall between data points. Methods HF1 through HF3 are discontinuous (they return actual data points), while HF4 through HF9 use linear interpolation between neighboring values.

In addition, four rounding-based methods (LOWER, HIGHER, NEAREST, MIDPOINT) use the same position formula as LINEAR (HF7) but apply different rounding instead of linear interpolation. These are useful when you need to select an actual data point rather than an interpolated value.

The default method is LINEAR (HF7), which is the default in R, S, NumPy, and Pandas.

Example:

val data = doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0)
data.quantile(0.25, QuantileMethod.LINEAR) // 2.0 (default, HF7)
data.quantile(0.25, QuantileMethod.MEDIAN_UNBIASED) // 1.75 (HF8)
data.quantile(0.25, QuantileMethod.WEIBULL) // 1.5 (HF6)

See also

Entries

Link copied to clipboard

Inverse of the empirical cumulative distribution function (HF1, R type 1).

Link copied to clipboard

Averaged inverse of the empirical CDF (HF2, R type 2).

Link copied to clipboard

Nearest observation with ties to even, as used by SAS (HF3, R type 3).

Link copied to clipboard

Linear interpolation of the empirical CDF (HF4, R type 4).

Link copied to clipboard

Piecewise linear function using the Hazen (1914) plotting position (HF5, R type 5).

Link copied to clipboard

Linear interpolation using the Weibull plotting position (HF6, R type 6).

Link copied to clipboard

Linear interpolation, the default method in most software (HF7, R type 7).

Link copied to clipboard

Approximately median-unbiased quantile estimator (HF8, R type 8).

Link copied to clipboard

Approximately normal-unbiased quantile estimator (HF9, R type 9).

Link copied to clipboard

Returns the lower of the two bracketing data points (floor).

Link copied to clipboard

Returns the higher of the two bracketing data points (ceiling).

Link copied to clipboard

Returns whichever bracketing data point is closer to the computed position.

Link copied to clipboard

Returns the average of the two bracketing data points.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.