ikr.simlib.statistics

## Class Statistic

• java.lang.Object
• ikr.simlib.statistics.Statistic
• Direct Known Subclasses:
AutoCorrelationStatistic, BoundaryStatistic, CondMeanStatistic, CondProbabilityStatistic, CorrelationStatistic, CounterStatistic, DistributionStatistic, FairnessStatistic, IntegralStatistic, MedianStatistic, ProbabilityStatistic, RateStatistic, SampleStatistic, VTStatistic, WeightedDistStatistic, WeightedMeanStatistic

public abstract class Statistic
extends java.lang.Object
Statistic is an abstract base class that controls measurement and printing.

All statistics classes are derived from the abstract base class Statistic that is characterized by the following:
• reacts to the signals init simulation, start simulation, stop simulation, start transient phase, and stop transient phase.
• defines an interface of purely abstract functions
• has a SimNode to support the exporting, importing, and printing of results.
Generally, measured values are acquired with the help of statistics during a batch (e.g. with the function update() which often exists in derived classes). These results are used to calculate an intermediate result with computeMeasures(int) at the end of a batch depending on the statistics type. At the end of all batches the individual intermediate results are dealt with as samples. Normally, a mean value is composed from these samples and the confidence interval is determined. The confidence interval is an indication of the statistical significance of the determined value. It is defined as an interval, in which the actual value lies with the probability $$q$$ (default value $$q = 0.95$$). In order to determine the confidence interval the student-t distribution is applied *.

Depending on the type of measured values, different procedures for registration and evaluation are available. Several classes have been derived from the base class Statistic, which define these measurement procedures. There is one class for each of these special statistics, that defines the interface for evaluation (e.g., SampleStatistic) and another that implements the evaluation functions (e.g., StdSampleStatistic).
The following auxiliary classes are available for the individual statistics:
• Summation for the registration and evaluation of measured values or samples from the batches e.g., mean value, variance, standard deviation and confidence interval of the mean values.
• Range to determine the smallest and largest mean value during a batch or the complete simulation.
• EstimationManager , StatisticEstimation , Student , StudentSearch , StudentCalc , and StudentMixed to determine the confidence interval (calls occur from Summation automatically)
Note: In earlier versions, a global statistics manager (class StatisticManager ), which contained the appropriate create<*>Statistic() and delete<*>Statistic() methods, was used to create an object of a special statistics class. The interface of the statistics manager was used to assure that the code of the model components remained unchanged, should a statistics type (e.g., SampleStatistic) be realized by a class not belonging to the pre-defined standard statistics class (e.g., StdSampleStatistic).
See Also:
"C. GÖRG: Verkehrstheoretische Modelle und stochastische Simulationstechniken zur Leistungsanalyse von Kommunikationsnetzen, Habilitation, RWTH Aachen, 1997.", "A. M. LAW, W. D. KELTON: Simulation Modeling & Analysis, 2nd edition, McGraw- Hill, 1991."
• ### Field Summary

Fields
Modifier and Type Field and Description
protected int sampleIndex
protected SimNode simNode
protected ResultWriter traceWriter
Writer object to write trace entries
• ### Constructor Summary

Constructors
Constructor and Description
Statistic(SimNode ownNode)
• ### Method Summary

Methods
Modifier and Type Method and Description
void addResultTag(ResultKeyword keyword, java.lang.String value)
Adds a tag (keyword and value) to the output of this statistic in the final results file.
void addResultTag(java.lang.String keyword, java.lang.String value)
Convenience method which creates a new result keyword from a string.
abstract void computeMeasures(int batchNumber)
void disableTracing()
Un-sets the writer object and disables tracing
void enableTracing(ResultWriter writer)
Sets the writer object and enables tracing
void handleInitSimulation()
void handleStartBatch(int batchNumber)
void handleStartTransientPhase()
void handleStopBatch(int batchNumber)
void handleStopTransientPhase()
protected void printComments(PrintResultWriter writer)
abstract void resetBatchStatistic()
only between batches
abstract void resetStatistic()
reset complete statistic
protected void update()
Basic update method, that triggers the output of trace entries
protected void writeTraceEntry()
Abstract method to be overwritten by derived statistics to output trace entries
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Field Detail

• #### simNode

protected final SimNode simNode
• #### traceWriter

protected ResultWriter traceWriter
Writer object to write trace entries
• #### sampleIndex

protected int sampleIndex
• ### Constructor Detail

• #### Statistic

public Statistic(SimNode ownNode)
• ### Method Detail

• #### resetStatistic

public abstract void resetStatistic()
reset complete statistic
• #### resetBatchStatistic

public abstract void resetBatchStatistic()
only between batches
• #### computeMeasures

public abstract void computeMeasures(int batchNumber)
• #### addResultTag

public void addResultTag(ResultKeyword keyword,
java.lang.String value)
Adds a tag (keyword and value) to the output of this statistic in the final results file. This can be used to write static, user-specific data to the results file. To write, e.g. the unit of a statistic, call addResultTag(ResultKeywords.UNIT, "bytes").
Parameters:
keyword - the key
value - the value
• #### addResultTag

public void addResultTag(java.lang.String keyword,
java.lang.String value)
Convenience method which creates a new result keyword from a string.
Parameters:
keyword - the key
value - the value
See Also:
addResultTag(ResultKeyword, String)
• #### printComments

protected void printComments(PrintResultWriter writer)
• #### handleInitSimulation

public void handleInitSimulation()
• #### handleStartBatch

public void handleStartBatch(int batchNumber)
• #### handleStartTransientPhase

public void handleStartTransientPhase()
• #### handleStopBatch

public void handleStopBatch(int batchNumber)
• #### handleStopTransientPhase

public void handleStopTransientPhase()
• #### update

protected void update()
Basic update method, that triggers the output of trace entries
• #### enableTracing

public void enableTracing(ResultWriter writer)
Sets the writer object and enables tracing
Parameters:
writer - ResultWriter connected to trace file
• #### disableTracing

public void disableTracing()
Un-sets the writer object and disables tracing
• #### writeTraceEntry

protected void writeTraceEntry()
Abstract method to be overwritten by derived statistics to output trace entries