Class QuantileDataAnalyzer

java.lang.Object
dataAnalysis.DynamicDataAnalyzerImpl
dataAnalysis.QuantileDataAnalyzer
All Implemented Interfaces:
DynamicDataAnalyzer

public class QuantileDataAnalyzer extends DynamicDataAnalyzerImpl
Analyzes the data in order to calculate the requested quantiles.
Author:
Federico Granata Date: 24-lug-2003 Time: 12.04.49
  • Constructor Details

    • QuantileDataAnalyzer

      public QuantileDataAnalyzer(double alfa, double precision, int maxData, double[] quantile, SortAlgorithm sorter)
      Creates a QuantileDataAnalyzer.
      Parameters:
      alfa - the quantile required for the confidence interval
      precision - maximum amplitude of confidence interval (precision = maxamplitude / mean)
      maxData - maximum number of data to be analyzed
      quantile - Requested quantiles //TODO: correct??
      sorter - Sorting algorithm used to manage data
    • QuantileDataAnalyzer

      public QuantileDataAnalyzer(double alfa, double precision, int maxData, double[] quantile)
      Creates a QuantileDataAnalyzer. A default sorting algorithm is used to manage data.
      Parameters:
      alfa - the quantile required for the confidence interval
      precision - maximum amplitude of confidence interval (precision = maxamplitude / mean)
      maxData - maximum number of data to be analyzed
      quantile - Requested quantiles
  • Method Details

    • addSample

      public boolean addSample(double newSample, double weight)
      Adds the new sample to the statistic.
      Specified by:
      addSample in interface DynamicDataAnalyzer
      Overrides:
      addSample in class DynamicDataAnalyzerImpl
      Parameters:
      newSample - the new sample
      weight - the weight of the newSample, if it is not needed put 1.
      Returns:
      true if the confidence interval is smaller than required by the user, or the data analyzed are too many
    • getQuantile

      public double getQuantile(double prob)
      returns the quantile with the requested probability.
      Parameters:
      prob - probability of the quantile
      Returns:
      the estimated quantile
    • getQuantiles

      public double[] getQuantiles()
      gets all requested quantiles.
      Returns:
      vector of quantiles.
    • getProbability

      public double getProbability(double quantile)
      returns the probability that a number extracted from the empirical distribution analyzed is greater than the quantile.
      Parameters:
      quantile - the requested quantile
      Returns:
      estimated probability
    • search

      protected double search(double element)
    • sort

      protected void sort()
    • HWtest

      protected boolean HWtest()
      Applies the spectral test to generate the Confidence Intervals. see: P. Heidelberger, Peter D. Welch "A spectral method for confidence interval generation and run length control in simulations"
      Overrides:
      HWtest in class DynamicDataAnalyzerImpl
      Returns:
      true if the precision requirement met. false if not.
    • calcVar

      protected void calcVar()
      updates the variance
      Overrides:
      calcVar in class DynamicDataAnalyzerImpl