public class PSquarePercentile extends AbstractStorelessUnivariateStatistic implements StorelessUnivariateStatistic, Serializable
StorelessUnivariateStatistic estimating percentiles using the
Note: This implementation is not synchronized and produces an approximate
result. For small samples, where data can be stored and processed in memory,
Percentile should be used.
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
PSquarePercentile.PSquareMarkers
An interface that encapsulates abstractions of the
P-square algorithm markers as is explained in the original works.
|
| Constructor and Description |
|---|
PSquarePercentile(double p)
Constructs a PSquarePercentile with the specific percentile value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the internal state of the Statistic
|
StorelessUnivariateStatistic |
copy()
Returns a copy of the statistic with the same internal state.
|
boolean |
equals(Object o)
Returns true iff
o is a PSquarePercentile returning the
same values as this for getResult() and getN() and also
having equal markers |
long |
getN()
Returns the number of values that have been added.
|
double |
getResult()
Returns the current value of the Statistic.
|
int |
hashCode()
Returns hash code based on getResult() and getN()
|
void |
increment(double observation)
Updates the internal state of the statistic to reflect the addition of the new value.
|
static PSquarePercentile.PSquareMarkers |
newMarkers(List<Double> initialFive,
double p)
A creation method to build Markers
|
double |
quantile()
Returns the quantile estimated by this statistic in the range [0.0-1.0]
|
String |
toString()
Returns a string containing the last observation, the current estimate
of the quantile and all markers.
|
evaluate, evaluate, incrementAll, incrementAllevaluate, getData, getDataRef, setData, setData, test, test, test, testclone, finalize, getClass, notify, notifyAll, wait, wait, waitincrementAll, incrementAllevaluate, evaluatepublic PSquarePercentile(double p)
p - the percentileOutOfRangeException - if p is not greater than 0 and less
than or equal to 100public int hashCode()
hashCode in class AbstractStorelessUnivariateStatisticpublic boolean equals(Object o)
o is a PSquarePercentile returning the
same values as this for getResult() and getN() and also
having equal markersequals in class AbstractStorelessUnivariateStatistico - object to compareo is a PSquarePercentile with
equivalent internal statepublic void increment(double observation)
increment in interface StorelessUnivariateStatisticincrement in class AbstractStorelessUnivariateStatisticobservation - the observation currently being added.public String toString()
public long getN()
getN in interface StorelessUnivariateStatisticpublic StorelessUnivariateStatistic copy()
copy in interface StorelessUnivariateStatisticcopy in interface UnivariateStatisticcopy in class AbstractStorelessUnivariateStatisticpublic double quantile()
getResult()public void clear()
clear in interface StorelessUnivariateStatisticclear in class AbstractStorelessUnivariateStatisticpublic double getResult()
getResult in interface StorelessUnivariateStatisticgetResult in class AbstractStorelessUnivariateStatisticDouble.NaN if it
has been cleared or just instantiated.public static PSquarePercentile.PSquareMarkers newMarkers(List<Double> initialFive, double p)
initialFive - list of initial five elementsp - the quantile desiredCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.