This class extends Tally. More...
Public Member Functions | |
| TallyHistogram (double a, double b, int numBins) | |
| Constructs a TallyHistogram statistical probe. | |
| TallyHistogram (String name, double a, double b, int numBins) | |
| Constructs a new TallyHistogram statistical probe with name name. | |
| void | init (double a, double b, int numBins) |
| Initializes this object. | |
| 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. | |
| TallyHistogram | trimHistogram () |
| Remove empty bins in the tails (left and right), without changing the bin size. | |
| TallyHistogram | addHistograms (TallyHistogram other) |
| Merges this histogram with the other histogram, by adding the bin counts of the two histograms. | |
| TallyHistogram | aggregateBins (int g) |
| Merges bins by groups of size \(g\). | |
| int[] | getCounters () |
| Returns the array of bin counters. | |
| int | getNumBins () |
| Returns the number of bins \(s\). | |
| double | getA () |
| Returns the left boundary \(a\) of the interval \([a,b]\). | |
| double | getB () |
| Returns the right boundary \(b\) of the interval \([a,b]\). | |
| double | getH () |
| Returns the width \(h\) of the bins. | |
| double | getProportionInBoundaries () |
| Returns the proportion of the collected observations that lie within the boundaries. | |
| 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 umontreal.ssj.stat.Tally | |
| Tally () | |
| Constructs a new unnamed Tally statistical probe. | |
| Tally (String name) | |
| Constructs a new Tally statistical probe with name name. | |
| void | setName (String name) |
| Set the name of this Tally to name. | |
| 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. | |
| double | sum () |
| Returns the sum cumulated so far for this probe. | |
| 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. | |
| double | standardDeviation () |
| Returns the sample standard deviation of the observations since the last initialization. | |
| void | confidenceIntervalNormal (double level, double[] centerAndRadius) |
| Computes a confidence interval on the mean. | |
| void | confidenceIntervalStudent (double level, double[] centerAndRadius) |
| Computes a confidence interval on the mean. | |
| String | formatCINormal (double level, int d) |
| Similar to confidenceIntervalNormal. | |
| String | formatCINormal (double level) |
| Equivalent to formatCINormal (level, 3). | |
| String | formatCIStudent (double level, int d) |
| Similar to confidenceIntervalStudent. | |
| String | formatCIStudent (double level) |
| Equivalent to formatCIStudent (level, 3). | |
| void | confidenceIntervalVarianceChi2 (double level, double[] interval) |
| Computes a confidence interval on the variance. | |
| String | formatCIVarianceChi2 (double level, int d) |
| Similar to confidenceIntervalVarianceChi2. | |
| String | report () |
| Returns a formatted string that contains a report on this probe. | |
| 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. | |
| String | shortReportHeader () |
| Returns a string containing the name of the values returned in the report strings. | |
| String | shortReport () |
| Formats and returns a short statistical report for this tally. | |
| 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. | |
| String | reportAndCIStudent (double level) |
Same as reportAndCIStudent(level, 3). | |
| double | getConfidenceLevel () |
| Returns the level of confidence for the intervals on the mean displayed in reports. | |
| void | setConfidenceLevel (double level) |
| Sets the level of confidence for the intervals on the mean displayed in reports. | |
| void | setConfidenceIntervalNone () |
| Indicates that no confidence interval needs to be printed in reports formatted by report, and shortReport. | |
| 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. | |
| 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. | |
| void | setShowNumberObs (boolean showNumObs) |
| Determines if the number of observations must be displayed in reports. | |
| Public Member Functions inherited from umontreal.ssj.stat.StatProbe | |
| String | getName () |
| Returns the name associated with this probe, or null if no name was specified upon construction. | |
| double | min () |
| Returns the smallest value taken by the variable since the last initialization of this probe. | |
| double | max () |
| Returns the largest value taken by the variable since the last initialization of this probe. | |
| boolean | isBroadcasting () |
| Determines if this statistical probe is broadcasting observations to registered observers. | |
| void | setBroadcasting (boolean b) |
| Instructs the probe to turn its broadcasting ON or OFF. | |
| boolean | isCollecting () |
| Determines if this statistical probe is collecting values. | |
| void | setCollecting (boolean b) |
| Turns ON or OFF the collection of statistical observations. | |
| void | addObservationListener (ObservationListener l) |
| Adds the observation listener l to the list of observers of this statistical probe. | |
| void | removeObservationListener (ObservationListener l) |
| Removes the observation listener l from the list of observers of this statistical probe. | |
| 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. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from umontreal.ssj.stat.StatProbe | |
| static String | report (String globalName, StatProbe[] probes) |
| Formats short reports for each statistical probe in the array probes while aligning the probes’ names. | |
| 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. | |
This class extends Tally.
It does not store individual observations, but in addition to maintaining the counters as in Tally, it also constructs a histogram for the observations. The histogram is over a bounded interval \([a,b]\) and has a fixed number of bins of equal width, both specified by the user. The number of observations falling into each of the bins is kept in an array of counters. This array can be accessed directly by the user. Note that one should never add or remove observations directly on this array of bin counters because this would put the Tally counters in an inconsistent state. Additional variables count the number of observations falling outside the interval \([a,b]\).
Definition at line 44 of file TallyHistogram.java.
| umontreal.ssj.stat.TallyHistogram.TallyHistogram | ( | double | a, |
| double | b, | ||
| int | numBins ) |
Constructs a TallyHistogram 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.
| a | left boundary of interval |
| b | right boundary of interval |
| numBins | number of bins (of equal width) |
Definition at line 63 of file TallyHistogram.java.
| umontreal.ssj.stat.TallyHistogram.TallyHistogram | ( | String | name, |
| double | a, | ||
| double | b, | ||
| int | numBins ) |
Constructs a new TallyHistogram statistical probe with name name.
| name | the name of the tally. |
| a | left boundary of interval |
| b | right boundary of interval |
| numBins | number of bins |
Definition at line 76 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.add | ( | double | x | ) |
Gives a new observation \(x\) to the statistical probe.
Updates are made as for the parent Tally object. Also increases by 1 the bin counter in which value \(x\) falls. Values that fall outside the interval \([a,b]\) are added to the extra bin counters.
| x | observation value |
Reimplemented from umontreal.ssj.stat.Tally.
Reimplemented in umontreal.ssj.stat.HistogramOnly.
Definition at line 151 of file TallyHistogram.java.
| TallyHistogram umontreal.ssj.stat.TallyHistogram.addHistograms | ( | TallyHistogram | other | ) |
Merges this histogram with the other histogram, by adding the bin counts of the two histograms.
| other | the histogram to add Returns the merged histogram. |
Definition at line 201 of file TallyHistogram.java.
| TallyHistogram umontreal.ssj.stat.TallyHistogram.aggregateBins | ( | int | g | ) |
Merges bins by groups of size \(g\).
If there are \(m\) bins initially, the new number of bins will be \(\lceil m/g\rceil\). The last bin may regroup less than \(g\) original bins if \(m\) is not a multiple of \(g\). In this case the upper bound \(b\) is increased accordingly.
Definition at line 227 of file TallyHistogram.java.
| TallyHistogram umontreal.ssj.stat.TallyHistogram.clone | ( | ) |
Clones this object and the array that stores the counters.
Reimplemented from umontreal.ssj.stat.Tally.
Reimplemented in umontreal.ssj.stat.HistogramOnly.
Definition at line 318 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.fillFromArray | ( | double[] | obs | ) |
Fills this object from the entire array obs.
Definition at line 132 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.fillFromArray | ( | double[] | obs, |
| int | numObs ) |
Fills this object from the first numObs observations in array obs.
Definition at line 123 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.fillFromTallyStore | ( | TallyStore | ts | ) |
Fills this object from the observations in a TallyStore object.
Definition at line 139 of file TallyHistogram.java.
| double umontreal.ssj.stat.TallyHistogram.getA | ( | ) |
Returns the left boundary \(a\) of the interval \([a,b]\).
Definition at line 275 of file TallyHistogram.java.
| double umontreal.ssj.stat.TallyHistogram.getB | ( | ) |
Returns the right boundary \(b\) of the interval \([a,b]\).
Definition at line 284 of file TallyHistogram.java.
| int[] umontreal.ssj.stat.TallyHistogram.getCounters | ( | ) |
Returns the array of bin counters.
Each counter contains the number of observations that fell in its corresponding bin.
Definition at line 257 of file TallyHistogram.java.
| double umontreal.ssj.stat.TallyHistogram.getH | ( | ) |
Returns the width \(h\) of the bins.
Definition at line 293 of file TallyHistogram.java.
| int umontreal.ssj.stat.TallyHistogram.getNumBins | ( | ) |
Returns the number of bins \(s\).
Definition at line 266 of file TallyHistogram.java.
| double umontreal.ssj.stat.TallyHistogram.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.
Definition at line 307 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.init | ( | ) |
Initializes all the counters and accumulators, including those of the Tally object.
Reimplemented from umontreal.ssj.stat.Tally.
Reimplemented in umontreal.ssj.stat.HistogramOnly.
Definition at line 113 of file TallyHistogram.java.
| void umontreal.ssj.stat.TallyHistogram.init | ( | double | a, |
| double | b, | ||
| int | numBins ) |
Initializes this object.
Divide the interval \([a,b]\) into
\(s\) bins of equal width and initializes all counters to 0.
| numBins | number of bins |
| a | left boundary of interval |
| b | right boundary of interval |
Definition at line 89 of file TallyHistogram.java.
| String umontreal.ssj.stat.TallyHistogram.toString | ( | ) |
Returns the bin counters as a String.
Reimplemented in umontreal.ssj.stat.HistogramOnly.
Definition at line 335 of file TallyHistogram.java.
| TallyHistogram umontreal.ssj.stat.TallyHistogram.trimHistogram | ( | ) |
Remove empty bins in the tails (left and right), without changing the bin size.
This gives a new TallyHistogram which may have fewer bins.
Definition at line 167 of file TallyHistogram.java.