public class Quantiler
extends java.lang.Object
The quantile estimate is probably not useful for fewer than 10 samples.
The estimate is most accurate for cumulative distribution functions that are smooth in the neighborhood of the desired quantile q. For such distributions, the accuracy of the estimate improves with successive updates.
This class is an implementation of the algorithm published by Jain, R. and Chlamtac, I., 1985, The PP algorithm for dynamic calculation of quantiles and histograms without storing observations: Comm. ACM, v. 28, n. 10.
Constructor and Description |
---|
Quantiler(float q)
Constructs a quantiler for the specified quantile fraction.
|
Quantiler(float q,
float fnull)
Constructs a quantiler for the specified quantile fraction and null value.
|
Modifier and Type | Method and Description |
---|---|
float |
estimate()
Returns the current quantile estimate.
|
static float |
estimate(float q,
float[] f)
Estimates the specified quantile for the specified and samples.
|
static float |
estimate(float q,
float[][] f)
Estimates the specified quantile for the specified and samples.
|
static float |
estimate(float q,
float[][][] f)
Estimates the specified quantile for the specified and samples.
|
static float |
estimate(float q,
float fnull,
float[] f)
Estimates the specified quantile for the specified null value and samples.
|
static float |
estimate(float q,
float fnull,
float[][] f)
Estimates the specified quantile for the specified null value and samples.
|
static float |
estimate(float q,
float fnull,
float[][][] f)
Estimates the specified quantile for the specified null value and samples.
|
float |
update(float f)
Updates the quantile estimate with the specified sample.
|
float |
update(float[] f)
Updates the quantile estimate with the specified samples.
|
float |
update(float[][] f)
Updates the quantile estimate with the specified samples.
|
float |
update(float[][][] f)
Updates the quantile estimate with the specified samples.
|
public Quantiler(float q)
q
- the quantile fraction; 0 <= q <= 1 is required.public Quantiler(float q, float fnull)
q
- the quantile; 0 <= q <= 1 is required.fnull
- the null value to be ignored in estimating the quantile.public float estimate()
public float update(float f)
f
- the sample used to update the estimate.public float update(float[] f)
f
- array[] of samples used to update the estimate.public float update(float[][] f)
f
- array[][] of samples used to update the estimate.public float update(float[][][] f)
f
- array[][][] of samples used to update the estimate.public static float estimate(float q, float[] f)
q
- the quantile; 0 <= q <= 1 is required.f
- array[] of samples used to compute the estimate.public static float estimate(float q, float[][] f)
q
- the quantile; 0 <= q <= 1 is required.f
- array[][] of samples used to compute the estimate.public static float estimate(float q, float[][][] f)
q
- the quantile; 0 <= q <= 1 is required.f
- array[][][] of samples used to compute the estimate.public static float estimate(float q, float fnull, float[] f)
q
- the quantile; 0 <= q <= 1 is required.fnull
- the null value to be ignored in estimating the quantile.f
- array[] of samples used to compute the estimate.public static float estimate(float q, float fnull, float[][] f)
q
- the quantile; 0 <= q <= 1 is required.fnull
- the null value to be ignored in estimating the quantile.f
- array[][] of samples used to compute the estimate.public static float estimate(float q, float fnull, float[][][] f)
q
- the quantile; 0 <= q <= 1 is required.fnull
- the null value to be ignored in estimating the quantile.f
- array[][][] of samples used to compute the estimate.