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, incrementAll
evaluate, getData, getDataRef, setData, setData, test, test, test, test
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
incrementAll, incrementAll
evaluate, evaluate
public 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 AbstractStorelessUnivariateStatistic
public 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 AbstractStorelessUnivariateStatistic
o
- object to compareo
is a PSquarePercentile
with
equivalent internal statepublic void increment(double observation)
increment
in interface StorelessUnivariateStatistic
increment
in class AbstractStorelessUnivariateStatistic
observation
- the observation currently being added.public String toString()
public long getN()
getN
in interface StorelessUnivariateStatistic
public StorelessUnivariateStatistic copy()
copy
in interface StorelessUnivariateStatistic
copy
in interface UnivariateStatistic
copy
in class AbstractStorelessUnivariateStatistic
public double quantile()
getResult()
public void clear()
clear
in interface StorelessUnivariateStatistic
clear
in class AbstractStorelessUnivariateStatistic
public double getResult()
getResult
in interface StorelessUnivariateStatistic
getResult
in class AbstractStorelessUnivariateStatistic
Double.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.