Class PSquarePercentile

java.lang.Object
org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic
org.apache.commons.math4.stat.descriptive.rank.PSquarePercentile
All Implemented Interfaces:
java.io.Serializable, StorelessUnivariateStatistic, UnivariateStatistic, MathArrays.Function

public class PSquarePercentile
extends AbstractStorelessUnivariateStatistic
implements StorelessUnivariateStatistic, java.io.Serializable
A StorelessUnivariateStatistic estimating percentiles using the P2 Algorithm as explained by Raj Jain and Imrich Chlamtac in P2 Algorithm for Dynamic Calculation of Quantiles and Histogram Without Storing Observations.

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.

See Also:
Serialized Form
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class 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 Summary

    Constructors 
    Constructor Description
    PSquarePercentile​(double p)
    Constructs a PSquarePercentile with the specific percentile value.
  • Method Summary

    Modifier and Type Method 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​(java.lang.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​(java.util.List<java.lang.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]
    java.lang.String toString()
    Returns a string containing the last observation, the current estimate of the quantile and all markers.

    Methods inherited from class org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic

    evaluate, evaluate, incrementAll, incrementAll

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic

    incrementAll, incrementAll

    Methods inherited from interface org.apache.commons.math4.stat.descriptive.UnivariateStatistic

    evaluate, evaluate