Collects data (PDF, CDF, etc.) of an array of histograms, each having a certain range of base (x) values and a range of data - y values. When an item (x,y) is added to Histogram2D Data, it first finds which individual histogram this item belongs to (this depends on the x value) and then adds y value to that histogram. The PDF and CDF are calculated for each individual histogram in the array. In addition, Histogram2D Data is capable of calculating envelopes - the areas containing a given percent of data in each simple histogram.
Histogram2D Data is particularly useful for analyzing a number of stochastic data sets, e.g. a number of realizations of a stochastic process in time obtained in different simulation runs.
The collected statistics can be visualized with the
Ignore – If selected, this analysis data object is excluded from the model.
Visible – If selected, the analysis data object is visible on a presentation at runtime.
Show name – If selected, the name of this analysis data object is displayed on a presentation diagram.
Use time as horizontal axis value
– If selected, the
histogram 2D data
timed, i.e. when new samples are added to the
histogram 2D data, Y-value is evaluated using the specified
Vertical axis value
expression, while X-value takes the current model time value.
Otherwise, the histogram 2D data element is phased, i.e. both X- and Y- values of the histograms are evaluated using the specified expressions (Horizontal axis value and Vertical axis value correspondingly).
Horizontal axis value – [Enabled if Use time as horizontal axis value is not selected] Expression, that will be dynamically evaluated to obtain the current base (X) value of the histograms.
Vertical axis value – Expression, that will be dynamically evaluated to obtain the current Y-value of the histograms.
Envelopes – Specify here comma-separated list of lower bounds of envelopes - the areas containing a given percent of data.
Number of intervals – The number of intervals for the X (Y) axis.
Range, from ... to – Here you define the range for X (Y) axis values.
Do not update data automatically – If selected, histogram2D data are not updated automatically. In this case you should add new samples by yourself as described here.
Update data automatically – If selected, new data samples are added automatically with the specified Recurrence time. Also, you can define here whether you want to Use model time or Use calendar dates. Depending on this choice, you can specify when updating begins with either First update time or Update date properties.
Histogram 2D Data element is represented in AnyLogic with instance of the class Histogram2DData This class provides the following functions:
void add(DataSet dataset)
- Adds the whole contents of a given dataset to the histogram data, updates PDF, CDF, and count.
void add(double xval, double yval) - Adds a sample data item to the histogram data, updates PDF, CDF, and count.
int count(int xindex) - Returns the number of samples added to the histogram with xindex.
double getCDF(int xindex, int yindex) - Returns the CDF (cumulative distribution function) at the END of the interval yindex of the histogram with xindex.
int getNumberOfXIntervals() - Returns the number of base (x) intervals, i.e. the number of individual histograms.
int getNumberOfYIntervals() - Returns the number of data (y) intervals in each individual histogram.
double getPDF(int xindex, int yindex) - Returns the PDF (probability distribution function) of the histogram with xindex at the interval yindex.
double getPDFOutsideHigh(int xindex) - Returns the percent of samples (0..1) in the histogram xindex higher than the specified maximum.
double getPDFOutsideLow(int xindex) - Returns the percent of samples (0..1) in the histogram xindex lower than the specified data (y) minimum.
double getXMax() - Returns the maximum x (base) value.
double getXMin() - Returns the minimum x (base) value.
double getYMax() - Returns the maximum y (data) value.
double getYMin() - Returns the minimum y (data) value.
void reset() - Fully resets the histogram data: discards all PDF/CDF data and statistics.
void setEnvelopes(double env) - Sets the array of envelopes to calculate.
String toString() - Returns a tab-separated multi-line textual representation of the histogram data.
API reference: Histogram2DData class