SSJ
3.3.1
Stochastic Simulation in Java
|
This class is similar to TallyHistogram, except that it does not maintain the min, max, average, and variance of the observations. More...
Public Member Functions | |
HistogramOnly (double a, double b, int s) | |
Constructs a HistogramOnly statistical probe. More... | |
HistogramOnly (String name, double a, double b, int s) | |
Constructs a new HistogramOnly statistical probe with name name . More... | |
void | init () |
void | add (double x) |
Gives a new observation \(x\) to the statistical collectors. More... | |
double | sum () |
double | average () |
double | variance () |
HistogramOnly | clone () |
Clones this object and the array which stores the counters. | |
String | toString () |
Returns the bin counters as a String . | |
String | report () |
String | shortReport () |
String | shortReportHeader () |
Public Member Functions inherited from TallyHistogram | |
TallyHistogram (double a, double b, int numBins) | |
Constructs a TallyHistogram statistical probe. More... | |
TallyHistogram (String name, double a, double b, int numBins) | |
Constructs a new TallyHistogram statistical probe with name name . More... | |
void | init (double a, double b, int numBins) |
Initializes this object. More... | |
void | init () |
Initializes all the counters and accumulators, including those of the Tally object. | |
void | fillFromArray (double[] obs, int numObs) |
Fills this object from the first numObs observations in array obs. | |
void | fillFromArray (double[] obs) |
Fills this object from the entire array obs. | |
void | fillFromTallyStore (TallyStore ts) |
Fills this object from the observations in a TallyStore object. | |
void | add (double x) |
Gives a new observation \(x\) to the statistical probe. More... | |
TallyHistogram | trimHistogram () |
Remove empty bins in the tails (left and right), without changing the bin size. More... | |
TallyHistogram | addHistograms (TallyHistogram other) |
Merges this histogram with the other histogram, by adding the bin counts of the two histograms. More... | |
TallyHistogram | aggregateBins (int g) |
Merges bins by groups of size \(g\). More... | |
int [] | getCounters () |
Returns the array of bin counters. More... | |
int | getNumBins () |
Returns the number of bins \(s\). More... | |
double | getA () |
Returns the left boundary \(a\) of the interval \([a,b]\). More... | |
double | getB () |
Returns the right boundary \(b\) of the interval \([a,b]\). More... | |
double | getH () |
Returns the width \(h\) of the bins. More... | |
double | getProportionInBoundaries () |
Returns the proportion of the collected observations that lie within the boundaries \([a,b]\) of the histogram; that is, the number that fell within \([a,b]\) divided by the total number that were collected. More... | |
TallyHistogram | clone () |
Clones this object and the array that stores the counters. | |
String | toString () |
Returns the bin counters as a String . | |
Public Member Functions inherited from Tally | |
Tally () | |
Constructs a new unnamed Tally statistical probe. | |
Tally (String name) | |
Constructs a new Tally statistical probe with name name . More... | |
void | setName (String name) |
Set the name of this Tally to name . More... | |
void | init () |
void | add (double x) |
Gives a new observation x to the statistical collector. More... | |
void | add (double[] x, int number) |
Adds the first number observations from the array x to this probe. | |
int | numberObs () |
Returns the number of observations given to this probe since its last initialization. More... | |
double | sum () |
double | average () |
Returns the average value of the observations since the last initialization. | |
double | variance () |
Returns the sample variance of the observations since the last initialization. More... | |
double | standardDeviation () |
Returns the sample standard deviation of the observations since the last initialization. More... | |
void | confidenceIntervalNormal (double level, double[] centerAndRadius) |
Computes a confidence interval on the mean. More... | |
void | confidenceIntervalStudent (double level, double[] centerAndRadius) |
Computes a confidence interval on the mean. More... | |
String | formatCINormal (double level, int d) |
Similar to confidenceIntervalNormal. More... | |
String | formatCINormal (double level) |
Equivalent to formatCINormal (level, 3) . More... | |
String | formatCIStudent (double level, int d) |
Similar to confidenceIntervalStudent. More... | |
String | formatCIStudent (double level) |
Equivalent to formatCIStudent (level, 3) . More... | |
void | confidenceIntervalVarianceChi2 (double level, double[] interval) |
Computes a confidence interval on the variance. More... | |
String | formatCIVarianceChi2 (double level, int d) |
Similar to confidenceIntervalVarianceChi2. More... | |
String | report () |
Returns a formatted string that contains a report on this probe. More... | |
String | report (double level, int d) |
Returns a formatted string that contains a report on this probe with a confidence interval level level using \(d\) fractional decimal digits. More... | |
String | shortReportHeader () |
String | shortReport () |
Formats and returns a short statistical report for this tally. More... | |
String | reportAndCIStudent (double level, int d) |
Returns a formatted string that contains a report on this probe (as in report ), followed by a confidence interval (as in formatCIStudent ), using \(d\) fractional decimal digits. More... | |
String | reportAndCIStudent (double level) |
Same as reportAndCIStudent(level, 3). More... | |
double | getConfidenceLevel () |
Returns the level of confidence for the intervals on the mean displayed in reports. More... | |
void | setConfidenceLevel (double level) |
Sets the level of confidence for the intervals on the mean displayed in reports. More... | |
void | setConfidenceIntervalNone () |
Indicates that no confidence interval needs to be printed in reports formatted by report, and shortReport. More... | |
void | setConfidenceIntervalNormal () |
Indicates that a confidence interval on the true mean, based on the central limit theorem, needs to be included in reports formatted by report and shortReport. More... | |
void | setConfidenceIntervalStudent () |
Indicates that a confidence interval on the true mean, based on the normality assumption, needs to be included in reports formatted by report and shortReport. More... | |
void | setShowNumberObs (boolean showNumObs) |
Determines if the number of observations must be displayed in reports. More... | |
Tally | clone () |
Clones this object. | |
Public Member Functions inherited from StatProbe | |
abstract void | init () |
Initializes the statistical collector. | |
void | setName (String name) |
Sets the name of this statistical collector to name . | |
String | getName () |
Returns the name associated with this probe, or null if no name was specified upon construction. More... | |
double | min () |
Returns the smallest value taken by the variable since the last initialization of this probe. More... | |
double | max () |
Returns the largest value taken by the variable since the last initialization of this probe. More... | |
double | sum () |
Returns the sum cumulated so far for this probe. More... | |
abstract double | average () |
Returns the average for this collector. More... | |
abstract String | report () |
Returns a string containing a report for this statistical collector. More... | |
abstract String | shortReport () |
Formats and returns a short, one-line report about this statistical probe. More... | |
abstract String | shortReportHeader () |
Returns a string containing the name of the values returned in the report strings. More... | |
boolean | isBroadcasting () |
Determines if this statistical probe is broadcasting observations to registered observers. More... | |
void | setBroadcasting (boolean b) |
Instructs the probe to turn its broadcasting ON or OFF. More... | |
boolean | isCollecting () |
Determines if this statistical probe is collecting values. More... | |
void | setCollecting (boolean b) |
Turns ON or OFF the collection of statistical observations. More... | |
void | addObservationListener (ObservationListener l) |
Adds the observation listener l to the list of observers of this statistical probe. More... | |
void | removeObservationListener (ObservationListener l) |
Removes the observation listener l from the list of observers of this statistical probe. More... | |
void | clearObservationListeners () |
Removes all observation listeners from the list of observers of this statistical probe. | |
void | notifyListeners (double x) |
Notifies the observation x to all registered observers if broadcasting is ON. More... | |
StatProbe | clone () throws CloneNotSupportedException |
Additional Inherited Members | |
Static Public Member Functions inherited from StatProbe | |
static String | report (String globalName, StatProbe[] probes) |
Formats short reports for each statistical probe in the array probes while aligning the probes’ names. More... | |
static String | report (String globalName, Iterable<? extends StatProbe > probes) |
Equivalent to #report(String,StatProbe[]), except that probes is an Iterable object instead of an array. More... | |
Protected Attributes inherited from TallyHistogram | |
int | numBins |
int [] | count |
int | leftCount |
int | rightCount |
double | m_h |
double | m_a |
double | m_b |
Protected Attributes inherited from Tally | |
int | numObs |
CIType | confidenceInterval = CIType.CI_NONE |
double | level = 0.95 |
int | digits = 3 |
Protected Attributes inherited from StatProbe | |
String | name |
double | maxValue |
double | minValue |
double | sumValue |
boolean | collect = true |
boolean | broadcast = false |
boolean | showNobs = true |
This class is similar to TallyHistogram, except that it does not maintain the min, max, average, and variance of the observations.
Only the counters for the histogram are maintained. Also it does not maintain counters for virtual bins on the left and on the right to count the observations that fall outside \([a,b]\). The methods that are supposed to return these values return an error message instead. The only advantage of not maintaining these counters and values is to increase speed (slightly). We define this class as an extension of TallyHistogram to avoid duplicating code.
HistogramOnly | ( | double | a, |
double | b, | ||
int | s | ||
) |
Constructs a HistogramOnly
statistical probe.
Divide the interval
\([a,b]\) into \(s\) bins of equal width and initializes a counter to 0 for each bin. Whenever an observation falls into a bin, the bin counter is increased by 1. There are two extra bins (and counters) that count the number of observations \(x\) that fall outside the interval \([a,b]\): one for those \(x< a\), and the other for those \(x > b\).
a | left boundary of interval |
b | right boundary of interval |
s | number of bins |
HistogramOnly | ( | String | name, |
double | a, | ||
double | b, | ||
int | s | ||
) |
Constructs a new HistogramOnly
statistical probe with name name
.
name | the name of the tally. |
a | left boundary of interval |
b | right boundary of interval |
s | number of bins |
void add | ( | double | x | ) |
Gives a new observation \(x\) to the statistical collectors.
Increases by 1 the bin counter in which value \(x\) falls.
x | observation value |