枚举类 Percentile.EstimationType
java.lang.Object
java.lang.Enum<Percentile.EstimationType>
org.hipparchus.stat.descriptive.rank.Percentile.EstimationType
- 所有已实现的接口:
-
Serializable
,Comparable<Percentile.EstimationType>
,Constable
- 封闭类:
-
Percentile
An enum for various estimation strategies of a percentile referred in wikipedia on quantile with the names of enum matching those of types mentioned in wikipedia.
Each enum corresponding to the specific type of estimation in wikipedia implements the respective formulae that specializes in the below aspects
- An index method to calculate approximate index of the estimate
- An estimate method to estimate a value found at the earlier computed index
- A minLimit on the quantile for which first element of sorted input is returned as an estimate
- A maxLimit on the quantile for which last element of sorted input is returned as an estimate
Users can now create Percentile
by explicitly passing this enum; such as by invoking Percentile.withEstimationType(EstimationType)
References:
-
嵌套类概要
从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
枚举常量概要
枚举常量说明This is the default type used in thePercentile
.This method has the following formulae for index and estimates
\( \begin{align} &index = (N+1)p\ \\ &estimate = x_{\lceil h\,-\,1/2 \rceil} \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\)The method R_1 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\, \\ &estimate= x_{\lceil h\,-\,1/2 \rceil} \\ &minLimit = 0 \\ \end{align}\)The method R_2 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\, \\ &estimate=\frac{x_{\lceil h\,-\,1/2 \rceil} + x_{\lfloor h\,+\,1/2 \rfloor}}{2} \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\)The method R_3 has the following formulae for index and estimates
\( \begin{align} &index= Np \\ &estimate= x_{\lfloor h \rceil}\, \\ &minLimit = 0.5/N \\ \end{align}\)The method R_4 has the following formulae for index and estimates
\( \begin{align} &index= Np\, \\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 1/N \\ &maxLimit = 1 \\ \end{align}\)The method R_5 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 0.5/N \\ &maxLimit = (N-0.5)/N \end{align}\)The method R_6 has the following formulae for index and estimates
\( \begin{align} &index= (N + 1)p \\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 1/(N+1) \\ &maxLimit = N/(N+1) \\ \end{align}\)The method R_7 implements Microsoft Excel style computation has the following formulae for index and estimates.
\( \begin{align} &index = (N-1)p + 1 \\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\)The method R_8 has the following formulae for index and estimates
\( \begin{align} &index = (N + 1/3)p + 1/3 \\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = (2/3)/(N+1/3) \\ &maxLimit = (N-1/3)/(N+1/3) \\ \end{align}\)The method R_9 has the following formulae for index and estimates
\( \begin{align} &index = (N + 1/4)p + 3/8\\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = (5/8)/(N+1/4) \\ &maxLimit = (N-3/8)/(N+1/4) \\ \end{align}\) -
方法概要
修饰符和类型方法说明protected double
estimate
(double[] work, int[] pivotsHeap, double pos, int length, KthSelector selector) Estimation based on Kth selection.double
evaluate
(double[] work, double p, KthSelector selector) Evaluate method to compute the percentile for a given bounded array.protected double
evaluate
(double[] work, int[] pivotsHeap, double p, KthSelector selector) protected abstract double
index
(double p, int length) Finds the index of array that can be used as starting index toestimate
percentile.static Percentile.EstimationType
返回带有指定名称的该类的枚举常量。static Percentile.EstimationType[]
values()
返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同
-
枚举常量详细资料
-
LEGACY
This is the default type used in thePercentile
.This method has the following formulae for index and estimates
\( \begin{align} &index = (N+1)p\ \\ &estimate = x_{\lceil h\,-\,1/2 \rceil} \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\) -
R_1
The method R_1 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\, \\ &estimate= x_{\lceil h\,-\,1/2 \rceil} \\ &minLimit = 0 \\ \end{align}\) -
R_2
The method R_2 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\, \\ &estimate=\frac{x_{\lceil h\,-\,1/2 \rceil} + x_{\lfloor h\,+\,1/2 \rfloor}}{2} \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\) -
R_3
The method R_3 has the following formulae for index and estimates
\( \begin{align} &index= Np \\ &estimate= x_{\lfloor h \rceil}\, \\ &minLimit = 0.5/N \\ \end{align}\) -
R_4
The method R_4 has the following formulae for index and estimates
\( \begin{align} &index= Np\, \\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 1/N \\ &maxLimit = 1 \\ \end{align}\) -
R_5
The method R_5 has the following formulae for index and estimates
\( \begin{align} &index= Np + 1/2\\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 0.5/N \\ &maxLimit = (N-0.5)/N \end{align}\) -
R_6
The method R_6 has the following formulae for index and estimates
\( \begin{align} &index= (N + 1)p \\ &estimate= x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 1/(N+1) \\ &maxLimit = N/(N+1) \\ \end{align}\)Note: This method computes the index in a manner very close to the default Hipparchus Percentile existing implementation. However the difference to be noted is in picking up the limits with which first element (p<1(N+1)) and last elements (p>N/(N+1))are done. While in default case; these are done with p=0 and p=1 respectively.
-
R_7
The method R_7 implements Microsoft Excel style computation has the following formulae for index and estimates.
\( \begin{align} &index = (N-1)p + 1 \\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = 0 \\ &maxLimit = 1 \\ \end{align}\) -
R_8
The method R_8 has the following formulae for index and estimates
\( \begin{align} &index = (N + 1/3)p + 1/3 \\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = (2/3)/(N+1/3) \\ &maxLimit = (N-1/3)/(N+1/3) \\ \end{align}\)As per Ref [2,3] this approach is most recommended as it provides an approximate median-unbiased estimate regardless of distribution.
-
R_9
The method R_9 has the following formulae for index and estimates
\( \begin{align} &index = (N + 1/4)p + 3/8\\ &estimate = x_{\lfloor h \rfloor} + (h - \lfloor h \rfloor) (x_{\lfloor h \rfloor + 1} - x_{\lfloor h \rfloor}) \\ &minLimit = (5/8)/(N+1/4) \\ &maxLimit = (N-3/8)/(N+1/4) \\ \end{align}\)
-
-
方法详细资料
-
values
返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同- 返回:
- 包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
-
valueOf
返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
-
name
- 要返回的枚举常量的名称。 - 返回:
- 返回带有指定名称的枚举常量
- 抛出:
-
IllegalArgumentException
- 如果该枚举类没有带有指定名称的常量 -
NullPointerException
- 如果参数为空值
-
index
protected abstract double index(double p, int length) Finds the index of array that can be used as starting index toestimate
percentile. The calculation of index calculation is specific to eachPercentile.EstimationType
.- 参数:
-
p
- the pth quantile -
length
- the total number of array elements in the work array - 返回:
- a computed real valued index as explained in the wikipedia
-
estimate
protected double estimate(double[] work, int[] pivotsHeap, double pos, int length, KthSelector selector) Estimation based on Kth selection. This may be overridden in specific enums to compute slightly different estimations.- 参数:
-
work
- array of numbers to be used for finding the percentile -
pivotsHeap
- an earlier populated cache if exists; will be used -
pos
- indicated positional index prior computed from callingindex(double, int)
-
length
- size of array considered -
selector
- aKthSelector
used for pivoting during search - 返回:
- estimated percentile
-
evaluate
Evaluate method to compute the percentile for a given bounded array using earlier computed pivots heap.
This basically calls theindex
and thenestimate
functions to return the estimated percentile value.- 参数:
-
work
- array of numbers to be used for finding the percentile -
pivotsHeap
- a prior cached heap which can speed up estimation -
p
- the pth quantile to be computed -
selector
- aKthSelector
used for pivoting during search - 返回:
- estimated percentile
- 抛出:
-
MathIllegalArgumentException
- if p is out of range -
NullArgumentException
- if work array is null
-
evaluate
Evaluate method to compute the percentile for a given bounded array. This basically calls theindex
and thenestimate
functions to return the estimated percentile value. Please note that this method does not make use of cached pivots.- 参数:
-
work
- array of numbers to be used for finding the percentile -
p
- the pth quantile to be computed -
selector
- aKthSelector
used for pivoting during search - 返回:
- estimated percentile
- 抛出:
-
MathIllegalArgumentException
- if length or p is out of range -
NullArgumentException
- if work array is null
-