AnyLogic
Expand
Font size
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
HistogramSimpleData, HistogramSmartData

public abstract class HistogramData
extends ChartItem
A base class for unidimensional histograms data objects. Histogram data always calculates the probability distribution function (PDF) and discrete statistics, and may or may not calculate the cumulative distribution function (CDF) and low/high percentiles.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods 
abstract void add​(double val)
Adds a sample data item to the histogram data.
boolean arePercentilesEnabled()
Checks if percentile calculation is enabled.
int count()
Returns the number of samples added to the histogram data.
void destroyUpdater_xjal()
This method is used to 'disconnect' this data class from the agent/experiment this object was defined in.
It is usually called on agent destroy so that experiment could use this data object e.g.
double deviation()
Returns the standard deviation of the histogram data.
double getCDF​(int index)
Returns the CDF (cumulative distribution function) at the END of the given interval.
double getIntervalWidth()
Returns the interval width, i.e.
double getMaxPDF()
Returns the maximum PDF value across all intervals, i.e.
int getNumberOfIntervals()
Returns the number of intervals in the histogram data.
double getPDF​(int index)
Returns the PDF (probability distribution function) at the given interval.
double getPercentHigh()
Returns the high percent value used for percentile calculation (1 is 100%).
double getPercentLow()
Returns the low percent value used for percentile calculation (1 is 100%).
java.util.List<java.util.List<java.lang.Object>> getPlainDataTable()  
StatisticsDiscrete getStatistics()
Returns the statisctics object embedded into the histogram data.
abstract double getXMax()
Returns the upper bound of the range covered by intervals.
abstract double getXMin()
Returns the lower bound of the range covered by intervals.
boolean isCDFEnabled()
Checks if the CDF calculation is enabled.
double max()
Returns the maximum sample value, or -infinity if no samples have been added.
double mean()
Returns the mean of the histogram.
double meanConfidence()
Returns the mean confidence interval of the histogram data.
Interval is calculated for the confidence level of 95%.
double min()
Returns the minimum sample value, or +infinity if no samples have been added.
void reset()
Fully resets the histogram data: discards all PDF/CDF data and statistics.
void setCDFEnabled​(boolean yes)
Enables or disables the CDF calculation.
void setPercentilesEnabled​(boolean yes)
Enables or disables calculation of percentiles (the data values corresponding to a certain low and high percent bounds).
void setPercents​(double low, double high)
Sets the percent bounds for percentile calculation.
java.lang.String toString()
Returns a tab-separated multi-line textual representation of the histogram data.
void update()
Should be overridden and call add( val ) if the user has specified the value to add.
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.analysis.ChartItem

getVersion

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Method Detail

reset

public void reset()
Fully resets the histogram data: discards all PDF/CDF data and statistics.

add

public abstract void add​(double val)
Adds a sample data item to the histogram data.
Parameters:
val - the sample value

update

public void update()
Should be overridden and call add( val ) if the user has specified the value to add. By default does nothing or uses updater if was created with appropriate constructor.
Overrides:
update in class ChartItem

getNumberOfIntervals

public int getNumberOfIntervals()
Returns the number of intervals in the histogram data.
Returns:
the number of intervals in the histogram data

getPDF

public double getPDF​(int index)
Returns the PDF (probability distribution function) at the given interval. The PDF is calculated as (number of samples within the interval)/(total nnumber of samples)
Parameters:
index - the index of the interval
Returns:
the PDF of the given interval

getMaxPDF

public double getMaxPDF()
Returns the maximum PDF value across all intervals, i.e. the maximum number of hits per interval divided by the total number of samples.
Returns:
the maximum PDF value across all intervals

getCDF

public double getCDF​(int index)
Returns the CDF (cumulative distribution function) at the END of the given interval. The CDF is calculated as (number of samples lower than the end of the interval)/ (total nnumber of samples)
Parameters:
index - the index of the interval
Returns:
the CDF at the END of the given interval

getStatistics

public StatisticsDiscrete getStatistics()
Returns the statisctics object embedded into the histogram data.
Returns:
the statisctics object embedded into the histogram data

count

public int count()
Returns the number of samples added to the histogram data.
Returns:
the number of samples added to the histogram data

mean

public double mean()
Returns the mean of the histogram.
Returns:
the mean of the histogram

min

public double min()
Returns the minimum sample value, or +infinity if no samples have been added.
Returns:
the minimum sample value or +infinity

max

public double max()
Returns the maximum sample value, or -infinity if no samples have been added.
Returns:
the maximum sample value or -infinity

deviation

public double deviation()
Returns the standard deviation of the histogram data.
Returns:
the standard deviation of the histogram data

meanConfidence

public double meanConfidence()
Returns the mean confidence interval of the histogram data.
Interval is calculated for the confidence level of 95%.
Returns:
the mean confidence interval of the histogram data

setCDFEnabled

public void setCDFEnabled​(boolean yes)
Enables or disables the CDF calculation. The percentiles are only calculated if CDF is calculated. Default is enabled.
Parameters:
yes - yes if true, calculate CDF

isCDFEnabled

public boolean isCDFEnabled()
Checks if the CDF calculation is enabled.
Returns:
true if CDF calculation is enabled, false otherwise

setPercentilesEnabled

public void setPercentilesEnabled​(boolean yes)
Enables or disables calculation of percentiles (the data values corresponding to a certain low and high percent bounds). The percentiles are only calculated if CDF is calculated. Default is enabled. The percentiles tolerance is interval width, i.e. you will only be able to find out which interval contains the percent bound. Default is enabled.
Parameters:
yes - if true, calculate percentiles

arePercentilesEnabled

public boolean arePercentilesEnabled()
Checks if percentile calculation is enabled.
Returns:
true if percentile calculation is enabled, false otherwise

setPercents

public void setPercents​(double low,
                        double high)
Sets the percent bounds for percentile calculation. A bound must be between 0 and 1, 1 means 100%. low must be <= (1-high). The default values are 0.1 and 0.1.
Parameters:
low - the low percent bound
high - the high percent bound

getPercentLow

public double getPercentLow()
Returns the low percent value used for percentile calculation (1 is 100%).
Returns:
the low percent value

getPercentHigh

public double getPercentHigh()
Returns the high percent value used for percentile calculation (1 is 100%).
Returns:
the high percent value

getXMin

public abstract double getXMin()
Returns the lower bound of the range covered by intervals.
Returns:
the lower bound of the range covered by intervals

getXMax

public abstract double getXMax()
Returns the upper bound of the range covered by intervals.
Returns:
the upper bound of the range covered by intervals

getIntervalWidth

public double getIntervalWidth()
Returns the interval width, i.e. the data range corresponding to one interval.
Returns:
the interval width

toString

public java.lang.String toString()
Returns a tab-separated multi-line textual representation of the histogram data.
Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the histogram data

getPlainDataTable

@AnyLogicInternalAPI
public java.util.List<java.util.List<java.lang.Object>> getPlainDataTable()

destroyUpdater_xjal

@AnyLogicInternalCodegenAPI
public void destroyUpdater_xjal()
This method is used to 'disconnect' this data class from the agent/experiment this object was defined in.
It is usually called on agent destroy so that experiment could use this data object e.g. in its charts.
How can we improve this article?