Package com.anylogic.engine.analysis
- java.lang.Object
- com.anylogic.engine.analysis.ChartItem
- com.anylogic.engine.analysis.Histogram2DData
- All Implemented Interfaces:
Serializable
public class Histogram2DData extends ChartItem
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
Histogram2DData, it first finds which individual histogram this item belongs
to (this depends on the x value) and then adds y value to that histigram.
The PDF and CDF are calculated for each individual histogram in the array.
In addition, Histogram2DData is capable of calculating envelopes - the areas
containing a given percent of data in each simple histogram.
Histogram2DData 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.
Histogram2DData 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.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
Histogram2DData |
Constructs a Histigram2DData with a given number of individual historgams each
having a given number of intervals, and sets x and y ranges.
|
Histogram2DData |
Constructs a Histigram2DData with a given number of individual historgams each
having a given number of intervals, and sets x and y ranges.
|
Modifier and Type | Method | Description |
---|---|---|
void | add |
Adds a sample data item to the histogram data, updates PDF, CDF and count.
|
void | add |
Adds the whole contents of a given dataset to the histogram data,
updates PDF, CDF and count.
|
int | count |
Returns the number of samples added to the histogram with xindex.
|
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 | getCDF |
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.
|
int | getNumberOfYIntervals() |
Returns the number of data (y) intervals in each individual historgam.
|
double | getPDF |
Returns the PDF (probability distribution function) of the histogram with xindex
at the interval yindex.
|
double | getPDFOutsideHigh |
Returns the percent of samples (0..1) in the histogram xindex higher
than the specified maximum.
|
double | getPDFOutsideLow |
Returns the percent of samples (0..1) in the histogram xindex lower
than the specified data (y) minimum.
|
List<List<Object>> | getPlainDataTable() | |
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 |
Sets the array of envelopes to calculate.
|
String | toString() |
Returns a tab-separated multi-line textual representation of the histogram data.
|
void | update() |
Should be overridden and call add( xval, yval ) if the user has
specified the values to add.
|
public Histogram2DData(int nXIntervals, double xmin, double xmax, int nYIntervals, double ymin, double ymax, double[] env)
Constructs a Histigram2DData with a given number of individual historgams each
having a given number of intervals, and sets x and y ranges.
- Parameters:
nXIntervals
- the number of base (x) intervals, i.e. the number of individual historgamsxmin
- the minimum x valuexmax
- the maximum x valuenYIntervals
- the number of data intervals in each individual historgamymin
- the lower bound of the range covered by the histogram intervalsymax
- the upper bound of the range covered by the histogram intervalsenv
- the array of envelopes to calculate. For example, the array { 0.4, 0.6, 0.8 } (this is the default array) means the histogram should calculate 40%, 60% and 80% envelopes for each x interval. Ifnull
, the default array is used
public Histogram2DData(int nXIntervals, double xmin, double xmax, int nYIntervals, double ymin, double ymax, double[] env, DataUpdater_xjal updater)
Constructs a Histigram2DData with a given number of individual historgams each
having a given number of intervals, and sets x and y ranges.
- Parameters:
nXIntervals
- the number of base (x) intervals, i.e. the number of individual historgamsxmin
- the minimum x valuexmax
- the maximum x valuenYIntervals
- the number of data intervals in each individual historgamymin
- the lower bound of the range covered by the histogram intervalsymax
- the upper bound of the range covered by the histogram intervalsenv
- the array of envelopes to calculate. For example, the array { 0.4, 0.6, 0.8 } (this is the default array) means the histogram should calculate 40%, 60% and 80% envelopes for each x interval. Ifnull
, the default array is usedupdater
- updater which may be used instead of overridingupdate()
method
@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.
It is usually called on agent destroy so that experiment could use this data object e.g. in its charts.
public void reset()
Fully resets the histogram data: discards all PDF/CDF data and statistics.
public void add(double xval, double yval)
Adds a sample data item to the histogram data, updates PDF, CDF and count.
- Parameters:
xval
- the base (x) value used to determine the target individual histogramyval
- the data (y) value that is added to the target individual histogram
public void add(BasicDataSet dataset)
Adds the whole contents of a given dataset to the histogram data,
updates PDF, CDF and count.
- Parameters:
dataset
- the dataset to add from
public void update()
Should be overridden and call add( xval, yval ) if the user has
specified the values to add. By default does nothing or uses
updater if was created with appropriate constructor.
public void setEnvelopes(double[] env)
Sets the array of envelopes to calculate. For example, the array { 0.4, 0.6, 0.8 }
(this is the default array) means the histogram should calculate 40%, 60% and 80%
envelopes for each x interval.
- Parameters:
env
- the array of envelope values in ascending order, each within [0..1]
public int getNumberOfXIntervals()
Returns the number of base (x) intervals, i.e. the number of individual historgams.
- Returns:
- the number of base (x) intervals, i.e. the number of individual historgams
public int getNumberOfYIntervals()
Returns the number of data (y) intervals in each individual historgam.
- Returns:
- the number of data (y) intervals in each individual historgam
public double getPDF(int xindex, int yindex)
Returns the PDF (probability distribution function) of the histogram with xindex
at the interval yindex. The PDF is calculated as (number of samples within the
interval) / (total number of samples in the histigram)
- Parameters:
xindex
- the index of the histogramyindex
- the index of the interval in the histogram- Returns:
- the PDF of the given interval
public double getCDF(int xindex, int yindex)
Returns the CDF (cumulative distribution function) at the END of the interval
yindex of the histogram with xindex. The CDF is calculated as (number of samples
lower than the end of the interval) / (total number of samples in the histigram).
- Parameters:
xindex
- the index of the histogramyindex
- the index of the interval in the histogram- Returns:
- the CDF at the END of the interval
public double getPDFOutsideLow(int xindex)
Returns the percent of samples (0..1) in the histogram xindex lower
than the specified data (y) minimum. It equals the CDF at the point of minimum.
- Parameters:
xindex
- the index of the histogram- Returns:
- the percent of samples lower than the specified minimum
public double getPDFOutsideHigh(int xindex)
Returns the percent of samples (0..1) in the histogram xindex higher
than the specified maximum.
- Parameters:
xindex
- the index of the histogram- Returns:
- the percent of samples lower higher the specified maximum
public int count(int xindex)
Returns the number of samples added to the histogram with xindex.
- Returns:
- the number of samples added to the histogram with xindex
public double getXMin()
Returns the minimum x (base) value.
- Returns:
- the minimum x (base) value
public double getXMax()
Returns the maximum x (base) value.
- Returns:
- the maximum x (base) value
public double getYMin()
Returns the minimum y (data) value.
- Returns:
- the minimum y (data) value
public double getYMax()
Returns the maximum y (data) value.
- Returns:
- the maximum y (data) value
public String toString()
Returns a tab-separated multi-line textual representation of the histogram data.
@AnyLogicInternalAPI public List<List<Object>> getPlainDataTable()