AnyLogic
Expand
Font size
All Implemented Interfaces:
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

Modifier and TypeMethodDescription
abstract voidadd(double val)
Adds a sample data item to the histogram data.
booleanarePercentilesEnabled()
Checks if percentile calculation is enabled.
intcount()
Returns the number of samples added to the histogram data.
voiddestroyUpdater_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.
doubledeviation()
Returns the standard deviation of the histogram data.
doublegetCDF(int index)
Returns the CDF (cumulative distribution function) at the END of the given interval.
doublegetIntervalWidth()
Returns the interval width, i.e.
doublegetMaxPDF()
Returns the maximum PDF value across all intervals, i.e.
intgetNumberOfIntervals()
Returns the number of intervals in the histogram data.
doublegetPDF(int index)
Returns the PDF (probability distribution function) at the given interval.
doublegetPercentHigh()
Returns the high percent value used for percentile calculation (1 is 100%).
doublegetPercentLow()
Returns the low percent value used for percentile calculation (1 is 100%).
List<List<Object>>getPlainDataTable() 
StatisticsDiscretegetStatistics()
Returns the statisctics object embedded into the histogram data.
abstract doublegetXMax()
Returns the upper bound of the range covered by intervals.
abstract doublegetXMin()
Returns the lower bound of the range covered by intervals.
booleanisCDFEnabled()
Checks if the CDF calculation is enabled.
doublemax()
Returns the maximum sample value, or -infinity if no samples have been added.
doublemean()
Returns the mean of the histogram.
doublemeanConfidence()
Returns the mean confidence interval of the histogram data.
Interval is calculated for the confidence level of 95%.
doublemin()
Returns the minimum sample value, or +infinity if no samples have been added.
voidreset()
Fully resets the histogram data: discards all PDF/CDF data and statistics.
voidsetCDFEnabled(boolean yes)
Enables or disables the CDF calculation.
voidsetPercentilesEnabled(boolean yes)
Enables or disables calculation of percentiles (the data values corresponding to a certain low and high percent bounds).
voidsetPercents(double low, double high)
Sets the percent bounds for percentile calculation.
StringtoString()
Returns a tab-separated multi-line textual representation of the histogram data.
voidupdate()
Should be overridden and call add( val ) if the user has specified the value to add.

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 Details

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 String toString()
Returns a tab-separated multi-line textual representation of the histogram data.
Overrides:
toString in class Object
Returns:
the textual representation of the histogram data

getPlainDataTable

@AnyLogicInternalAPI
public List<List<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.