Batch Statistic
This class automates the batching of observations that may be dependent. It computes the batch means of the batches and reports statistics across the batches. Suppose we have observations, Y(1), Y(2), Y(3), ... Y(n). This class specifies the minimum number of batches, the minimum number of observations per batch, and a maximum batch multiple. The defaults are 20, 16, and 2, respectively. This implies that the maximum number of batches will be 40 = (min number of batches times the maximum batch multiple). The class computes the average of each batch, which are called the batch means.
Once the minimum number of observations are observed, a batch is formed. As more and more observations are collected, more and more batches are formed until the maximum number of batches is reached. Then the batches are re-batched down so that there are 20 batches (the minimum number of batches). This re-batching essentially doubles the batch size and halves the number of batches. In other words, each sequential pair of batches are combined into one batch by averaging their batch means. The purpose of this batching process is to break up correlation structure within the data.
Confidence intervals and summary statistics can be reported across the batch means under the assumption that the batch means are independent. The lag-1 correlation of the batch means is available as well as the Von-Neumann test statistic for independence of the batch means.
Creates a BatchStatistic with the given name For example, if minNumBatches = 20 and maxNBMultiple = 2 then the maximum number of batches allowed will be 40. maxNBMultiple must be 2 or more.
Parameters
The minimum number of batches, must be >= 2
The minimum number of observations per batch, must be >= 2
The maximum number of batches as a multiple of the minimum number of batches.
A String representing the name of the statistic
An array of values to collect on
Constructors
Properties
Fills up an array with the statistics defined by this interface statistics0 = getCount() statistics1 = getAverage() statistics2 = getStandardDeviation() statistics3 = getStandardError() statistics4 = getHalfWidth() statistics5 = getConfidenceLevel() statistics6 = getMin() statistics7 = getMax() statistics8 = getSum() statistics9 = getVariance() statistics10 = getDeviationSumOfSquares() statistics11 = getLastValue() statistics12 = getKurtosis() statistics13 = getSkewness() statistics14 = getLag1Covariance() statistics15 = getLag1Correlation() statistics16 = getVonNeumannLag1TestStatistic() statistics17 = getNumberMissing()
Returns a copy of the batch means array. Zero index is the first batch mean
A confidence interval for the mean based on the confidence level
Holds the confidence coefficient for the statistic
The header string for the CVS representation
the size of the current batch
Returns a copy of the StatisticIfc that is tabulating the current batch
Gets the sum of squares of the deviations from the average This is the numerator in the classic sample variance formula
Gets the lag-1 generate correlation of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31
Gets the lag-1 generate covariance of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31
The maximum number of batches as determined by the max num batches multiple
The minimum number of observations per batch
The minimum number of batches required
The multiple of the minimum number of batches that determines the maximum number of batches e.g. if the min. number of batches is 20 and the max number batches multiple is 2, then we can have at most 40 batches
Counts the number of observations that were negative, strictly less than zero.
the number of batches
Used to count the number of missing data points presented When a data point having the value of (Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) are presented it is excluded from the summary statistics and the number of missing points is noted. Implementers of subclasses are responsible for properly collecting this value and resetting this value.
the number of times re-batching has occurred
Counts the number of observations that were positive, strictly greater than zero.
Returns the relative error: getStandardError() / getAverage()
Returns the relative width of the default confidence interval: 2.0 * getHalfWidth() / getAverage()
Gets the sample standard deviation of the observations. Simply the square root of variance
Gets the standard error of the observations. Simply the generate standard deviation divided by the square root of the number of observations
Fills the map with the values of the statistics. Key is statistic label and value is the value of the statistic. The keys are: "Count" "Average" "Standard Deviation" "Standard Error" "Half-width" "Confidence Level" "Lower Limit" "Upper Limit" "Minimum" "Maximum" "Sum" "Variance" "Deviation Sum of Squares" "Kurtosis" "Skewness" "Lag 1 Covariance" "Lag 1 Correlation" "Von Neumann Lag 1 Test Statistic" "Number of missing observations"
Gets the total number of observations observed
Gets the Von Neumann Lag 1 test statistic for checking the hypothesis that the data are uncorrelated Note: See Handbook of Simulation, Jerry Banks editor, McGraw-Hill, pg 253.
Returns the asymptotic p-value for the Von Nueumann Lag-1 Test Statistic:
Functions
Allows the adding (attaching) of an observer to the observable
Collect on the supplied value. Double.NaN, Double.NEGATIVE_INFINITY, and Double.POSITIVE_INFINITY values are counted as missing. Null values are not permitted.
Collects on the boolean value true = 1.0, false = 0.0
Collects on the values in the supplied array.
Collect on the double value return by the function
Collects on the Int value
Collects on the Long value
Collects on all the values in the supplied collection.
Collects on the values returned by the supplied GetValueIfc
Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.
A confidence interval for the mean based on the confidence level
Return a copy of the information as an instance of a statistic
Returns how many observers are currently attached to the observable
Detaches all the observers from the observable
Allows the deletion (removing) of an observer from the observable
Returns a copy of the BatchStatistic
Returns true if the observer is already attached
Computes the right most meaningful digit according to (int)Math.floor(Math.log10(a*getStandardError())) See doi 10.1287.opre.1080.0529 by Song and Schmeiser
Takes the current batch means and batches them into the specified number of batches. This does not change the current batch means
Returns the relative width of the level of the confidence interval: 2.0 * getHalfWidth(level) / getAverage()
Returns a data class holding the statistical data with the confidence interval specified by the given level.
Returns a data class holding the statistical data with the confidence interval specified by the given level. The class is suitable for inserting into a database table.
Converts a statistic to a data frame with two columns. The first column holds the names of the statistics and the second column holds the values. The valueLabel can be used to provide a column name for the value columns. By default, it is "Value".