QuantileEstimationMethod

internal sealed interface QuantileEstimationMethod<Value : Comparable<Value>, Index : Number>

Inspired by Hyndman and Fan (1996) Sample Quantiles in Statistical Packages. The American Statistician, 50, 361-365. DOI:10.1080/00031305.1996.10473566

and https://commons.apache.org/proper/commons-statistics/commons-statistics-descriptive/javadocs/api-1.1/org/apache/commons/statistics/descriptive/Quantile.EstimationMethod.html

They are split in Selecting (where oneBasedIndexOfQuantile gives an exact index of the quantile in a sorted list of type Int) and Interpolating (where oneBasedIndexOfQuantile gives an approximation for that index of type Double). For the Selecting, the Value type can thus be any self-comparable type, but for Interpolating, Value can only be of type Double, because it needs to perform calculations on the values.

TODO https://github.com/Kotlin/dataframe/issues/1121

  • add R2, R4, R5, R6, R9

  • make public if configurable for percentile function

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun oneBasedIndexOfQuantile(p: Double, count: Int): Index

Gives the (1-based) index of the p-quantile for a distribution of size count. If the result h is a whole number, the h'th smallest of the count values is the quantile estimate. If not, h is an estimation of the index of the p-quantile. Rounding or interpolation needs to occur to get the actual quantile estimate.

Link copied to clipboard
abstract fun quantile(p: Double, values: List<Value>): Value