Stochastic Simulation in Java
Namespaces | Classes
umontreal::ssj::stat Namespace Reference

Tools for Collecting Statistics and computing some estimators. More...


 Univariate density estimation.


class  FunctionOfMultipleMeansTally
 Represents a statistical collector for estimating a function of multiple means with a confidence interval based on the delta theorem [203] . More...
class  HistogramChartToLatex
class  HistogramOnly
 This class is similar to TallyHistogram, except that it does not maintain the min, max, average, and variance of the observations. More...
interface  ObservationListener
 Represents an object that can listen to observations broadcast by statistical probes. More...
class  PgfDataTable
 Represents a data table which has a name, a number of observations (rows), a number of fields (columns), an array that contains the names (identifiers) of the fields, and a two-dimensional array that contains the data. More...
class  ScaledHistogram
 This class provides histograms for which the bin counts (heights of rectangles) are replaced by real-valued frequencies (in double) and can be rescaled. More...
class  StatProbe
 The objects of this class are statistical probes or collectors, which are elementary devices for collecting statistics. More...
class  Tally
 A subclass of StatProbe. More...
class  TallyHistogram
 This class extends Tally. More...
class  TallyStore
 This class is a variant of Tally for which the individual observations are stored in a list implemented as a DoubleArrayList. More...

Detailed Description

Tools for Collecting Statistics and computing some estimators.

This package provides elementary tools for collecting data and computing some estimators and confidence intervals. The base class umontreal.ssj.stat.StatProbe implements common methods needed by all data collectors (statistical probes). Its subclass umontreal.ssj.stat.Tally collects data as a sequence of observations \(X_1,X_2,\dots \), and computes sample averages, sample standard deviations, and confidence intervals based on normal or Student approximations. It does not store observations. The class umontreal.ssj.stat.TallyStore is similar, but it stores the individual observations in a DoubleArrayList, a type of extensible array imported from the COLT library. This permits one to compute more quantities and to use the methods provided by COLT for computing descriptive statistics. Data can also be collected directly in aggregated form in histograms via TallyHistogram or HistogramOnly. The class ScaledHistogram permits one rescale histograms to view them as density estimators, to construct averaged-shifted histograms, and polygonal interpolations of histograms.

The class umontreal.ssj.simevents.Accumulate, in package simevents, computes integrals and averages with respect to time. This class is in package simevents because its operation depends on the simulation clock.

PgfDataTable provides tools to construct tables of observations (rows) in which each observation has many fields (columns). These tables are in a appropriate format for the pgfplot LaTeX package. They can also be forwarded to other software for visualization, etc.

Subpackages of the package stat offer additional tools. For example, the packages stat.list and stat.matrix provide lists and matrices of Tally objects and tools to manage them. The package stat.density provides tools for density estimation, e.g., via histograms and kernel density estimators.

All classes that represent statistical probes support the observer design pattern, well-known in software engineering [63] . This pattern facilitates the separation of data generation (by the simulation program) from data processing (for statistical reports and displays). This can be very helpful in particular in large simulation programs or libraries, where different objects may need to process the same data in different ways. A statistical probe maintains a list of registered umontreal.ssj.stat.ObservationListener objects, and broadcasts information to all its registered observers whenever appropriate. Any object that implements the interface umontreal.ssj.stat.ObservationListener can register as an observer. For an example, see the program QueueObs in the SSJ tutorial.

When writing complex simulation programs, in data generation portions, one uses the statistical probes as usual but with observation notification turned on. To turn it on, one can invoke the method notifyObs in umontreal.ssj.stat.StatProbe on the probes. In this mode, a probe becomes a distribution agency which broadcasts received observations to all observers that registered to it. It will also fulfill its collector functionality unless it is disabled explicitly by calling the method stopCollectStat in umontreal.ssj.stat.StatProbe. When statistical collection is disabled, the probes are only distribution agencies. Data processing parts of a program can be implemented through observers. An observer is a class implementing the Observer interface. It can be registered to any class extending Observable, including umontreal.ssj.stat.StatProbe. The observed value is passed to the observers through the second argument of the update method of java.util.Observer, which is an Object. The argument must then be type-casted to a Double wrapper object before the observation value can be extracted.