public static enum Percentile.EstimationType extends Enum<Percentile.EstimationType>
Each enum corresponding to the specific type of estimation in wikipedia implements the respective formulae that specializes in the below aspects
Users can now create Percentile
by explicitly passing this enum;
such as by invoking Percentile.withEstimationType(EstimationType)
References:
Enum Constant and Description |
---|
LEGACY
This is the default type used in the
Percentile .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}\) |
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}\) |
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}\) |
Modifier and Type | Method and Description |
---|---|
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 to
estimate
percentile. |
static Percentile.EstimationType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Percentile.EstimationType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Percentile.EstimationType LEGACY
Percentile
.This method
has the following formulae for index and estimatespublic static final Percentile.EstimationType R_1
public static final Percentile.EstimationType R_2
public static final Percentile.EstimationType R_3
public static final Percentile.EstimationType R_4
public static final Percentile.EstimationType R_5
public static final Percentile.EstimationType R_6
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.
public static final Percentile.EstimationType R_7
public static final Percentile.EstimationType R_8
As per Ref [2,3] this approach is most recommended as it provides an approximate median-unbiased estimate regardless of distribution.
public static final Percentile.EstimationType R_9
public static Percentile.EstimationType[] values()
for (Percentile.EstimationType c : Percentile.EstimationType.values()) System.out.println(c);
public static Percentile.EstimationType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullprotected abstract double index(double p, int length)
estimate
percentile. The calculation of index calculation is specific to each
Percentile.EstimationType
.p
- the pth quantilelength
- the total number of array elements in the work arrayprotected double estimate(double[] work, int[] pivotsHeap, double pos, int length, KthSelector selector)
work
- array of numbers to be used for finding the percentilepos
- indicated positional index prior computed from calling
index(double, int)
pivotsHeap
- an earlier populated cache if exists; will be usedlength
- size of array consideredselector
- a KthSelector
used for pivoting during searchprotected double evaluate(double[] work, int[] pivotsHeap, double p, KthSelector selector)
index
and then
estimate
functions to return the estimated percentile value.work
- array of numbers to be used for finding the percentilepivotsHeap
- a prior cached heap which can speed up estimationp
- the pth quantile to be computedselector
- a KthSelector
used for pivoting during searchMathIllegalArgumentException
- if p is out of rangeNullArgumentException
- if work array is nullpublic double evaluate(double[] work, double p, KthSelector selector)
index
and then
estimate
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 percentilep
- the pth quantile to be computedselector
- a KthSelector
used for pivoting during searchMathIllegalArgumentException
- if length or p is out of rangeNullArgumentException
- if work array is nullCopyright © 2016–2019 Hipparchus.org. All rights reserved.