Class FixedBinsAccumulator
java.lang.Object
org.djutils.stats.summarizers.quantileaccumulator.FixedBinsAccumulator
- All Implemented Interfaces:
QuantileAccumulator
FixedBinsAccumulator.java.
This accumulator is created with a caller prescribes set of bins. All bins have the same width.
Copyright (c) 2021-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
This accumulator is created with a caller prescribes set of bins. All bins have the same width.
Copyright (c) 2021-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Constructor Summary
ConstructorsConstructorDescriptionFixedBinsAccumulator(double minimumBinCenter, double binWidth, int binCount) Construct a new FullStorageAccumulator. -
Method Summary
Modifier and TypeMethodDescriptionlongRetrieve the number of registered values that were above the range of this FixedBinsAccumulator.longRetrieve the number of registered values that were below the range of this FixedBinsAccumulator.doublegetBinCenter(int bin) Return the center of a particular bin.intRetrieve the bin count.doubleRetrieve the bin width.doublegetCumulativeProbability(Tally tally, double quantile) Get, or estimate fraction of registered values between -infinity up to and including a given quantile.longgetN()Retrieve the total number of registered values.doublegetQuantile(Tally tally, double probability) Compute (or approximate) the value that corresponds to the given fraction (percentile).voidReset (clear all accumulated information).doubleregister(double value) Ingest one value with weight 1.toString()
-
Constructor Details
-
FixedBinsAccumulator
public FixedBinsAccumulator(double minimumBinCenter, double binWidth, int binCount) Construct a new FullStorageAccumulator.- Parameters:
minimumBinCenter- center value of bin for minimum value of range (minimum value in range isminimumBinCenter - binWidth / 2, maximum value in range isminimumBinCenter + binWidth * (binCount - 0.5))binWidth- width of each binbinCount- number of bins
-
-
Method Details
-
getBinWidth
public double getBinWidth()Retrieve the bin width.- Returns:
- the bin width
-
getBinCount
public int getBinCount()Retrieve the bin count.- Returns:
- the bin count
-
getN
public long getN()Retrieve the total number of registered values.- Returns:
- the total number of registered values
-
getBelowCount
public long getBelowCount()Retrieve the number of registered values that were below the range of this FixedBinsAccumulator.- Returns:
- the number of registered values that were below the range of this FixedBinsAccumulator
-
getAboveCount
public long getAboveCount()Retrieve the number of registered values that were above the range of this FixedBinsAccumulator.- Returns:
- the number of registered values that were above the range of this FixedBinsAccumulator
-
getBinCenter
public double getBinCenter(int bin) Return the center of a particular bin.- Parameters:
bin- int the bin number- Returns:
- the center of requested bin
-
register
public double register(double value) Description copied from interface:QuantileAccumulatorIngest one value with weight 1. Should be called only from the Tally object and AFTER processing the value in the tally.- Specified by:
registerin interfaceQuantileAccumulator- Parameters:
value- the value- Returns:
- the registered value
-
getQuantile
Description copied from interface:QuantileAccumulatorCompute (or approximate) the value that corresponds to the given fraction (percentile).- Specified by:
getQuantilein interfaceQuantileAccumulator- Parameters:
tally- the tally object that accumulates mean, minimum, maximum, count, etc.probability- value between 0.0 and 1.0 (both inclusive)- Returns:
- the computed or approximated quantile value
-
getCumulativeProbability
public double getCumulativeProbability(Tally tally, double quantile) throws IllegalArgumentException Description copied from interface:QuantileAccumulatorGet, or estimate fraction of registered values between -infinity up to and including a given quantile.- Specified by:
getCumulativeProbabilityin interfaceQuantileAccumulator- Parameters:
tally- the tally object that accumulates mean, minimum, maximum, count, etc.quantile- the given quantile- Returns:
- the estimated or observed fraction of registered values between -infinity up to and including the given quantile. When this QuantileAccumulator has registered zero values; this method shall return NaN.
- Throws:
IllegalArgumentException- when quantile is NaN
-
initialize
public void initialize()Description copied from interface:QuantileAccumulatorReset (clear all accumulated information).- Specified by:
initializein interfaceQuantileAccumulator
-
toString
-