Class StandardizedTimeSeriesStatistic

    • Field Detail

      • BATCH_SIZE

        public static final int BATCH_SIZE
        the default minimum number of observations per batch, the batch size
        See Also:
        Constant Field Values
    • Constructor Detail

      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic()
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(java.lang.String name)
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
        Parameters:
        name - the name of the statistic
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(boolean saveBMFlag)
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
        Parameters:
        saveBMFlag - Indicates whether or not the batch means will be saved, true means saved, false means not saved. False is the default
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(boolean saveBMFlag,
                                               double[] values)
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
        Parameters:
        saveBMFlag - Indicates whether or not the batch means will be saved, true means saved, false means not saved. False is the default
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(double[] values)
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
        Parameters:
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(java.lang.String name,
                                               double[] values)
        Creates an STS Statistic with the default batch size = 1024 The batch means will not be saved
        Parameters:
        name - The name
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize)
        Creates an STS Statistic with the given batchsize. The batch means will not be saved
        Parameters:
        batchSize - Must be >= 2
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               double[] values)
        Creates an STS Statistic with the given batchsize. The batch means will not be saved
        Parameters:
        batchSize - Must be >= 2
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               java.lang.String name)
        Creates an STS Statistic with the given batch size and name. The batch means will not be save.
        Parameters:
        batchSize - Must be >= 2
        name - The name
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               java.lang.String name,
                                               double[] values)
        Creates an STS Statistic with the given batch size and name. The batch means will not be save.
        Parameters:
        batchSize - Must be >= 2
        name - The name
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               boolean saveBMFlag)
        Creates an STS Statistic with the given batch size.
        Parameters:
        batchSize - Must be >=2
        saveBMFlag - Indicates whether or not the batch means will be saved, true means saved, false means not saved. False is the default
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               boolean saveBMFlag,
                                               double[] values)
        Creates an STS Statistic with the given batch size.
        Parameters:
        batchSize - Must be >=2
        saveBMFlag - Indicates whether or not the batch means will be saved, true means saved, false means not saved. False is the default
        values - an array of values to collect statistics on
      • StandardizedTimeSeriesStatistic

        public StandardizedTimeSeriesStatistic​(int batchSize,
                                               boolean saveBMFlag,
                                               java.lang.String name,
                                               double[] values)
        Creates an STS Statistic with the given batch size.
        Parameters:
        batchSize - Must be >=2
        saveBMFlag - Indicates whether or not the batch means will be saved, true means saved, false means not saved. False is the default
        name - The name of the statistic
        values - an array of values to collect statistics on
    • Method Detail

      • getNumBatches

        public final double getNumBatches()
        Gets the number of batches
        Returns:
        Returns the number of batches
      • collect

        public final void collect​(double value)
        Description copied from interface: CollectorIfc
        Collect on the supplied value
        Parameters:
        value - a double representing the observation
      • reset

        public final void reset()
        Description copied from interface: CollectorIfc
        Resets the collector as if no observations had been collected.
      • getCount

        public final double getCount()
        Description copied from interface: StatisticAccessorIfc
        Gets the count of the number of the observations.
        Returns:
        A double representing the count
      • getAverage

        public final double getAverage()
        Description copied from interface: StatisticAccessorIfc
        Gets the unweighted average of the observations.
        Returns:
        A double representing the average or Double.NaN if no observations.
      • getSum

        public final double getSum()
        Description copied from interface: StatisticAccessorIfc
        Gets the sum of the observations.
        Returns:
        A double representing the unweighted sum
      • getDeviationSumOfSquares

        public final double getDeviationSumOfSquares()
        Description copied from interface: StatisticAccessorIfc
        Gets the sum of squares of the deviations from the average This is the numerator in the classic sample variance formula
        Returns:
        A double representing the sum of squares of the deviations from the average
      • getVariance

        public final double getVariance()
        Description copied from interface: StatisticAccessorIfc
        Gets the sample variance of the observations.
        Returns:
        A double representing the generate variance or Double.NaN if 1 or less observations.
      • getStandardDeviation

        public final double getStandardDeviation()
        Description copied from interface: StatisticAccessorIfc
        Gets the sample standard deviation of the observations. Simply the square root of getVariance()
        Returns:
        A double representing the generate standard deviation or Double.NaN if 1 or less observations.
      • getHalfWidth

        public final double getHalfWidth​(double alpha)
        Description copied from interface: StatisticAccessorIfc
        Gets the confidence interval half-width. Simply the generate standard error times the confidence coefficient as determined by an appropriate sampling distribution
        Parameters:
        alpha - the confidence level
        Returns:
        A double representing the half-width or Double.NaN if < 1 observation
      • getMin

        public final double getMin()
        Description copied from interface: StatisticAccessorIfc
        Gets the minimum of the observations.
        Returns:
        A double representing the minimum
      • getMax

        public final double getMax()
        Description copied from interface: StatisticAccessorIfc
        Gets the maximum of the observations.
        Returns:
        A double representing the maximum
      • getLastValue

        public final double getLastValue()
        Description copied from interface: StatisticAccessorIfc
        Gets the last observed data point
        Returns:
        A double representing the last observations
      • getKurtosis

        public final double getKurtosis()
        Description copied from interface: StatisticAccessorIfc
        Gets the kurtosis of the data
        Returns:
        A double representing the kurtosis
      • getSkewness

        public final double getSkewness()
        Description copied from interface: StatisticAccessorIfc
        Gets the skewness of the data
        Returns:
        A double representing the skewness
      • getStandardError

        public final double getStandardError()
        Description copied from interface: StatisticAccessorIfc
        Gets the standard error of the observations. Simply the generate standard deviation divided by the square root of the number of observations
        Returns:
        A double representing the standard error or Double.NaN if < 1 observation
      • getLag1Correlation

        public final double getLag1Correlation()
        Description copied from interface: StatisticAccessorIfc
        Gets the lag-1 generate correlation of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31
        Returns:
        A double representing the generate correlation or Double.NaN if <=2 observations
      • getLag1Covariance

        public final double getLag1Covariance()
        Description copied from interface: StatisticAccessorIfc
        Gets the lag-1 generate covariance of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31
        Returns:
        A double representing the generate covariance or Double.NaN if <=2 observations
      • getVonNeumannLag1TestStatistic

        public final double getVonNeumannLag1TestStatistic()
        Description copied from interface: StatisticAccessorIfc
        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:
        A double representing the Von Neumann test statistic
      • getVonNeumannLag1TestStatisticPValue

        public final double getVonNeumannLag1TestStatisticPValue()
        Description copied from interface: StatisticAccessorIfc
        Returns the asymptotic p-value for the Von Nueumann Lag-1 Test Statistic:

        Normal.stdNormalComplementaryCDF(getVonNeumannLag1TestStatistic());

        Returns:
        the p-value
      • getLeadingDigitRule

        public final int getLeadingDigitRule​(double a)
        Description copied from interface: StatisticAccessorIfc
        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
        Parameters:
        a - the std error multiplier
        Returns:
        the meaningful digit
      • getBatchMeansIterator

        public final java.util.Iterator<Statistic> getBatchMeansIterator()
        Returns an iterator across all the batch means collected so far
        Returns:
        an iterator across all the batch means collected so far
      • getSTSStandardError

        public final double getSTSStandardError()
        Gets the standard error for the STS confidence interval
        Returns:
        standard error for the STS confidence interval
      • getSTSHalfWidth

        public final double getSTSHalfWidth()
        Computes the half-width of a STS based confidence interval based on a 95% confidence level
        Returns:
        the half-width of a STS based confidence interval based on a 95% confidence level
      • getSTSHalfWidth

        public final double getSTSHalfWidth​(double level)
        Computes the half-width of a STS based confidence interval based on the supplied confidence coefficient.
        Parameters:
        level - the confidence level
        Returns:
        the half-width
      • getSTSAreaConstant

        public final double getSTSAreaConstant()
        Computes an estimate of the STS Area Constant
        Returns:
        an estimate of the STS Area Constant
      • getAcrossBatchStatistic

        public final StatisticAccessorIfc getAcrossBatchStatistic()
        Gets a StatisticAccessIfc that represents the across batch statistics
        Returns:
        Returns the statistic.
      • getCurrentBatchStatistic

        public final StatisticAccessorIfc getCurrentBatchStatistic()
        Gets a StatisticAccessIfc for the current batch that is being collected. This is a statistic on the data within the batch
        Returns:
        Returns the statistic.
      • getUnBatchedStatistic

        public final StatisticAccessorIfc getUnBatchedStatistic()
        Gets a StatisticAccessorIfc that represents statistics that have been collected on each unbatched data point This is the same as using a Statistic on the data
        Returns:
        Returns the statistic.
      • toString

        public final java.lang.String toString()
        Description copied from interface: StatisticAccessorIfc
        Returns a String representation of the Statistic
        Specified by:
        toString in interface StatisticAccessorIfc
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String with basic summary statistics
      • setBatchSize

        protected final void setBatchSize​(int batchSize)
        Sets the number of batches, must be >=2
        Parameters:
        batchSize - The number of batches to set
      • main

        public static void main​(java.lang.String[] args)