The Statistics object calculates statistical information (mean value, minimum, maximum, etc.) on a series of data samples of type double.
The object works differently depending on whether data are considered discrete or continuous.
Data samples are time-persistent; that is, value persists in continuous time but changes only at discrete time moments (like e.g. queue length). The samples must be added to this statistics with ascending time stamps. The mean, variance, etc. functions assume the last value added holds until the time of call. The mean of such dataset is a time-weighted value.
Samples have no duration in time (like e.g. products cost or patients LOS). They occur as isolated, discrete points in time, so the mean is simply the sum of individual samples divided by number of samples.
To
create a statistics object
Ignore – If selected, the statistics is excluded from the model.
Visible – If selected, the statistics is visible on a presentation at runtime.
Show name – If selected, the name of the statistics is displayed on a presentation diagram.
Discrete (samples have no duration in time) – If selected, data are considered discrete.Continuous (samples have duration in time) – If selected, data are considered continuous.
Value – Expression, that will be dynamically evaluated to obtain the current data sample.
Do not update data automatically – If selected, statistics is 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 starting at the exact time (select the option Use model time) or date (select Use calendar dates) specified below and repeating with the specified Recurrence time.
Log to database – If selected, data collected by this Statistics element will be added into the model execution log statistics_log (if logging is turned on in the model's Database properties).
You can set the Statistics object to write data into the model execution log statistics_log. To do this, select the statistics' option Log to database, and enable the model to write to the log as described here.
While running the model, you can view the collected statistics and optionally copy it to the Clipboard so that later on you can paste it to some other application (e.g. to Excel) to perform statistical analysis.void
add(double value, double time)
- Adds a new data sample to
the statistics, i.e. notifies the statistics about the value change at
the given time.
Parameters:
value
- the new value;
time
- the time
int count() - Returns the number of samples added to the statistics.
void reset() - Discards all statistics accumulated.
double max() - Returns the maximum sample value, or -infinity if no samples have been added.
double min() - Returns the minimum sample value, or infinity if no samples have been added.
String toString() - Returns the tab-separated multiline textual representation of the statistics.
double deviation() - Returns the deviation of the statistics at the time of last update.
double deviation(double time) - Returns the standard deviation of the statistics at the given time assuming the last value added holds until the given time.
double integral() - Returns the mean integral of the statistics at the time of last update, or 0 if no samples have been added.
double integral(double time) - Returns the integral of the statistics at the given time assuming the last value added holds until the given time, or 0 if no samples have been added.
double mean() - Returns the mean of the statistics at the time of last update, or 0 if no samples have been added.
double mean(double time) - Returns the mean of the statistics at the given time assuming the last value added holds until the given time, or 0 if no samples have been added.
double
meanConfidence()
- Returns the half-width mean
confidence of
the statistics at the time of last update, or 0 if no samples have been
added. Mean confidence interval is calculated in assumption that
confidence level is equal to 95%.
double
meanConfidence(double time)
- Returns the half-width mean confidence interval of the
statistics at
the
given time assuming the last value added holds until the given time, or
infinityif
less than 2
samples have been added or if no time has elapsed. Mean confidence
interval is calculated in assumption that confidence level is equal to
95%.
double variance() - Returns the variance of the statistics at the time of last update, or 0 if no samples have been added.
double variance(double time) - Returns the variance of the statistics at the given time assuming the last value added holds until the given time, or 0 if no samples have been added.
void add(double value) - Adds a sample value to the statistics.
int count() - Returns the number of samples added to the statistics.
void reset() - Discards all statistics accumulated.
double max() - Returns the maximum sample value, or -infinity if no samples have been added.
double min() - Returns the minimum sample value, or infinity if no samples have been added.
String toString() - Returns the tab-separated multiline textual representation of the statistics.
double deviation() - Returns the standard deviation of the statistics.
double mean() - Returns the mean of the statistics, or 0 if no samples have been added.
double meanConfidence() - Returns the half-width mean confidence interval of the statistics, or 0 if no samples have been added. Mean confidence interval is calculated in assumption that confidence level is equal to 95%.
double sum() - The function returns sum of the samples added to the statistics, or 0 if no samples have been added.
double variance() - Returns the variance of the statistics, or 0 if less than 2 samples have been added.