Class MultipleComparisonAnalyzer

  • All Implemented Interfaces:
    GetNameIfc

    public class MultipleComparisonAnalyzer
    extends java.lang.Object
    implements GetNameIfc
    Holds data to perform multiple comparisons Performs pairwise comparisons and computes pairwise differences and variances. The user must supply the data samples over which the comparison will be made. This is supplied in a Map with key representing a name (identifier) for the data and an array representing the observations. This class computes all the pairwise differences and the variances of the differences in the form of tabulated statistics.
    • Constructor Detail

      • MultipleComparisonAnalyzer

        public MultipleComparisonAnalyzer​(java.util.Map<java.lang.String,​double[]> dataMap)
    • Method Detail

      • getDefaultIndifferenceZone

        public final double getDefaultIndifferenceZone()
        Returns:
        the default indifference zone parameter
      • setDefaultIndifferenceZone

        public final void setDefaultIndifferenceZone​(double defaultIndifferenceZone)
        Sets the default indifference zone parameter
        Parameters:
        defaultIndifferenceZone - must be greater than or equal to zero
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface GetNameIfc
        Returns:
        a string representing the name of the object
      • setName

        public final void setName​(java.lang.String name)
        Parameters:
        name - the name of the comparison
      • getDataNames

        public java.lang.String[] getDataNames()
        The names of items being compared as an array of strings
        Returns:
        names of items being compared as an array of strings
      • getNumberDatasets

        public int getNumberDatasets()
        The number of data sets stored in the analyzer. There is a data set stored for each name.
        Returns:
        number of data sets stored in the analyzer.
      • contains

        public boolean contains​(java.lang.String dataName)
        Returns true if the analyzer has data for the name
        Parameters:
        dataName - the name to check
        Returns:
        true if the analyzer has data for the name
      • setDataMap

        public final void setDataMap​(java.util.Map<java.lang.String,​double[]> dataMap)
        Sets the underlying data map. Any data already in the analyzer will be replaced. The supplied dataMap must not be null. There needs to be at least 2 data arrays The length of each data array must be the same.
        Parameters:
        dataMap - the map to read from
      • computePairedDifferenceStatistics

        public java.util.LinkedHashMap<java.lang.String,​java.util.LinkedHashMap<java.lang.String,​Statistic>> computePairedDifferenceStatistics()
        The key to each LinkedHashMap is the name of the data The Statistic is based on the paired differences
        Returns:
        a map of the paired difference statistics
      • computePairedDifferences

        public java.util.LinkedHashMap<java.lang.String,​java.util.LinkedHashMap<java.lang.String,​double[]>> computePairedDifferences()
        The key to each LinkedHashMap is the name of the data The array contains the paired differences
        Returns:
        a map holding the paired differences as an array for each data name
      • getPairedDifference

        public double[] getPairedDifference​(java.lang.String s1,
                                            java.lang.String s2)
        The paired differences as a array for the pair of data names given by the strings. If the data names don't exist a null pointer exception will occur
        Parameters:
        s1 - the name of data set number 1
        s2 - the name of data set number 2
        Returns:
        an array of paired differences
      • getPairedDifferenceStatistics

        public java.util.List<StatisticAccessorIfc> getPairedDifferenceStatistics()
        A list holding the statistics for all of the pairwise differences is returned
        Returns:
        A list holding the statistics for all of the pairwise differences
      • getPairedDifferenceStatistic

        public Statistic getPairedDifferenceStatistic​(java.lang.String s1,
                                                      java.lang.String s2)
        The statistics for the pair of data names given by the strings. If the data names don't exist a null pointer exception will occur
        Parameters:
        s1 - the name of data set number 1
        s2 - the name of data set number 2
        Returns:
        a Statistic collected over the paired differences
      • getNamesOfPairedDifferences

        public java.lang.String[] getNamesOfPairedDifferences()
        Each paired difference is labeled with data name i - data name j for all i, j The returns the names as an array of strings
        Returns:
        the names as an array of strings
      • getNameOfMaximumAverageOfDifferences

        public java.lang.String getNameOfMaximumAverageOfDifferences()
        The name of the maximum average difference
        Returns:
        name of the maximum average difference
      • getNameOfMinumumAverageOfDifferences

        public java.lang.String getNameOfMinumumAverageOfDifferences()
        The name of the minimum average difference
        Returns:
        name of the minimum average difference
      • getMaximumOfAveragesOfDifferences

        public double getMaximumOfAveragesOfDifferences()
        The actual maximum average of the differences
        Returns:
        actual maximum average of the differences
      • getIndexOfMaximumOfAveragesOfDifferences

        public int getIndexOfMaximumOfAveragesOfDifferences()
        Suppose there are n data names. Then there are n(n-1)/2 pairwise differences. This method returns the index of the maximum of the array given by getAveragesOfDifferences()
        Returns:
        the index of the maximum of the array given by getAveragesOfDifferences()
      • getMinimumOfAveragesOfDifferences

        public double getMinimumOfAveragesOfDifferences()
        Returns the minimum value of the average of the differences
        Returns:
        the minimum value of the average of the differences
      • getIndexOfMinimumOfAveragesOfDifferences

        public int getIndexOfMinimumOfAveragesOfDifferences()
        The actual minimum average of the differences
        Returns:
        actual minimum average of the differences
      • getAveragesOfDifferences

        public double[] getAveragesOfDifferences()
        Suppose there are n data names. Then there are n(n-1)/2 pairwise differences. This method returns averages of the differences in an array. The elements of the array have correspondence to the array of strings returned by getNamesOfPairedDifferences()
        Returns:
        averages of the differences in an array.
      • getVariancesOfDifferences

        public double[] getVariancesOfDifferences()
        Suppose there are n data names. Then there are n(n-1)/2 pairwise differences. This method returns variances of the differences in an array. The elements of the array have correspondence to the array of strings returned by getNamesOfPairedDifferences()
        Returns:
        variances of the differences in an array
      • getConfidenceIntervalsOfDifferenceData

        public java.util.List<Interval> getConfidenceIntervalsOfDifferenceData​(double level)
        Suppose there are n data names. Then there are n(n-1)/2 pairwise differences. This method returns a list of confidence intervals of the differences in an array. The elements of the array have correspondence to the array of strings returned by getNamesOfPairedDifferences()
        Parameters:
        level - the confidence level
        Returns:
        list of confidence intervals of the differences in an array
      • getMaxVarianceOfDifferences

        public double getMaxVarianceOfDifferences()
        The maximum variance of the differences
        Returns:
        maximum variance of the differences
      • getAverageDifference

        public double getAverageDifference​(java.lang.String s1,
                                           java.lang.String s2)
        The average for the pair of data names given by the strings. If the data names don't exist a null pointer exception will occur
        Parameters:
        s1 - the name of data set number 1
        s2 - the name of data set number 2
        Returns:
        average for the pair of data names given by the strings
      • getVarianceOfDifference

        public double getVarianceOfDifference​(java.lang.String s1,
                                              java.lang.String s2)
        The variance for the pair of data names given by the strings. If the data names don't exist a null pointer exception will occur
        Parameters:
        s1 - the name of data set number 1
        s2 - the name of data set number 2
        Returns:
        variance for the pair of data names given by the strings
      • computeDifference

        public static double[] computeDifference​(double[] f,
                                                 double[] s)
        A helper method to compute the difference between the two arrays
        Parameters:
        f - first array
        s - second array
        Returns:
        the difference
      • checkLengths

        public final boolean checkLengths​(java.util.Map<java.lang.String,​double[]> dataMap)
        Checks if each double[] in the map has the same length
        Parameters:
        dataMap - the data map to check
        Returns:
        true if same length
      • getStatistic

        public Statistic getStatistic​(java.lang.String name)
        Get statistics on the data associated with the name. If the name is not in the analyzer, null is returned
        Parameters:
        name - the name of the data set
        Returns:
        the statistic over the data set
      • getIndexOfName

        public final int getIndexOfName​(java.lang.String name)
        Returns the index associated with the data set name The supplied name must be contained in the analyzer. Use contains() to check.
        Parameters:
        name - must be associated with a data set
        Returns:
        the index associated with the data set name
      • getStatistics

        public java.util.List<StatisticAccessorIfc> getStatistics()
        A list of statistics for all the data
        Returns:
        list of statistics for all the data
      • getAverage

        public double getAverage​(java.lang.String name)
        The average for the named data or Double.NaN if the name is not in the collector
        Parameters:
        name - the name of the data set
        Returns:
        average for the named data or Double.NaN
      • getVariance

        public double getVariance​(java.lang.String name)
        The variance for the named data or Double.NaN if the name is not in the collector
        Parameters:
        name - the name of the data set
        Returns:
        variance for the named data or Double.NaN
      • getMaximumAverageOfData

        public double getMaximumAverageOfData()
        The maximum of the average of all the data
        Returns:
        maximum of the average of all the data
      • getIndexOfMaximumAverageOfData

        public int getIndexOfMaximumAverageOfData()
        The index of the maximum average
        Returns:
        index of the maximum average
      • getNameOfMaximumAverageOfData

        public java.lang.String getNameOfMaximumAverageOfData()
        The name of the maximum average
        Returns:
        name of the maximum average
      • getMinimumAverageOfData

        public double getMinimumAverageOfData()
        The minimum of the average of all the data
        Returns:
        minimum of the average of all the data
      • getIndexOfMinimumAverageOfData

        public int getIndexOfMinimumAverageOfData()
        The index of the minimum of the average of all the data
        Returns:
        index of the minimum of the average of all the data
      • getNameOfMinimumAverageOfData

        public java.lang.String getNameOfMinimumAverageOfData()
        The name of the minimum of the average of all the data
        Returns:
        name of the minimum of the average of all the data
      • getAveragesOfData

        public double[] getAveragesOfData()
        An array of all the averages of the data Each element is the average for each of the n data names
        Returns:
        An array of all the averages of the data
      • getVariancesOfData

        public double[] getVariancesOfData()
        An array of all the variances of the data
        Returns:
        An array of all the variances of the data
      • getDiffBtwItemAndMaxOfRest

        public double getDiffBtwItemAndMaxOfRest​(java.lang.String name)
        Gets the difference between the system average associated with the name and maximum of the rest of the averages
        Parameters:
        name - the name of the data set
        Returns:
        the difference between the system average associated with the name and maximum of the rest of the averages
      • getDiffBtwItemAndMaxOfRest

        public double getDiffBtwItemAndMaxOfRest​(int index)
        Gets the difference between the system average associated with the index and maximum of the rest of the averages
        Parameters:
        index - the index
        Returns:
        difference between the system average associated with the index and maximum of the rest of the averages
      • getAllDiffBtwItemsAndMaxOfRest

        public double[] getAllDiffBtwItemsAndMaxOfRest()
        Computes the difference between each dataset average and the maximum of the rest of the averages for each dataset. If d[] represents the differences then d[0] is the difference between the first dataset average and the maximum over the averages of the other datasets and so on.
        Returns:
        the difference between each dataset average and the maximum of the rest of the averages for each dataset.
      • getDiffBtwItemAndMinOfRest

        public double getDiffBtwItemAndMinOfRest​(java.lang.String name)
        Gets the difference between the system average associated with the name and minimum of the rest of the averages
        Parameters:
        name - the name of the data set
        Returns:
        difference between the system average associated with the name and minimum of the rest of the averages
      • getDiffBtwItemAndMinOfRest

        public double getDiffBtwItemAndMinOfRest​(int index)
        Gets the difference between the system average associated with the index and minimum of the rest of the averages
        Parameters:
        index - the index
        Returns:
        the difference between the system average associated with the index and minimum of the rest of the averages
      • getAllDiffBtwItemsAndMinOfRest

        public double[] getAllDiffBtwItemsAndMinOfRest()
        Computes the difference between each dataset average and the minimum of the rest of the averages for each dataset. If d[] represents the differences then d[0] is the difference between the first dataset average and the minimum over the averages of the other datasets and so on
        Returns:
        the difference between each dataset average and the minimum of the rest of the averages for each dataset.
      • getMCBMaxInterval

        public Interval getMCBMaxInterval​(int index)
        Form the maximum comparison with the best (MCB) interval for the dataset at the supplied index using an the default indifference zone
        Parameters:
        index - the index
        Returns:
        the interval for maximum case
      • getMCBMaxInterval

        public Interval getMCBMaxInterval​(int index,
                                          double delta)
        Form the maximum comparison with the best (MCB) interval for the dataset at the supplied index using the supplied indifference delta.
        Parameters:
        index - the index
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        the interval for the maximum comparison
      • getMCBMaxIntervals

        public java.util.List<Interval> getMCBMaxIntervals()
        Forms all MCB intervals for the maximum given the default indifference zone
        Returns:
        all the intervals
      • getMCBMaxIntervals

        public java.util.List<Interval> getMCBMaxIntervals​(double delta)
        Forms all MCB intervals for the maximum given the supplied delta
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        all the intervals
      • getMCBMaxIntervalsAsMap

        public java.util.Map<java.lang.String,​Interval> getMCBMaxIntervalsAsMap()
        The MCB maximum intervals in the form of a map. The key names are the names of the data sets with indifference delta based on the default
        Returns:
        the map holding the intervals
      • getMCBMaxIntervalsAsMap

        public java.util.Map<java.lang.String,​Interval> getMCBMaxIntervalsAsMap​(double delta)
        The MCB maximum intervals in the form of a map. The key names are the names of the data sets
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        the map holding the intervals
      • getMCBMaxIntervalsAsSB

        public java.lang.StringBuilder getMCBMaxIntervalsAsSB()
        Returns a StringBuilder representation of the MCB maximum intervals based on default indifference zone setting
        Returns:
        a StringBuilder representation of the intervals
      • getMCBMaxIntervalsAsSB

        public java.lang.StringBuilder getMCBMaxIntervalsAsSB​(double delta)
        Returns a StringBuilder representation of the MCB maximum intervals
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        a StringBuilder representation of the MCB maximum intervals
      • getMCBMinInterval

        public Interval getMCBMinInterval​(int index)
        Form the maximum comparison with the best (MCB) interval for the dataset at the supplied index using the default indifference zone
        Parameters:
        index - the index of the interval
        Returns:
        the interval
      • getMCBMinInterval

        public Interval getMCBMinInterval​(int index,
                                          double delta)
        Form the maximum comparison with the best (MCB) interval for the dataset at the supplied index using the supplied indifference delta.
        Parameters:
        index - the index of the interval
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        the interval
      • getMCBMinIntervals

        public java.util.List<Interval> getMCBMinIntervals()
        Forms all MCB intervals for the minimum given the default indifference zone
        Returns:
        MCB intervals for the minimum given the default indifference zone
      • getMCBMinIntervals

        public java.util.List<Interval> getMCBMinIntervals​(double delta)
        Forms all MCB intervals for the minimum given the default indifference zone
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        MCB intervals for the minimum given the default indifference zone
      • getMCBMinIntervalsAsMap

        public java.util.Map<java.lang.String,​Interval> getMCBMinIntervalsAsMap()
        The MCB minimum intervals in the form of a map. The key names are the names of the data sets with the default indifference zone
        Returns:
        MCB minimum intervals in the form of a map
      • getMCBMinIntervalsAsMap

        public java.util.Map<java.lang.String,​Interval> getMCBMinIntervalsAsMap​(double delta)
        The MCB minimum intervals in the form of a map. The key names are the names of the data sets
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        MCB minimum intervals in the form of a map
      • getMCBMinIntervalsAsSB

        public java.lang.StringBuilder getMCBMinIntervalsAsSB()
        Returns a StringBuilder representation of the MCB minimum intervals
        Returns:
        a StringBuilder representation of the MCB minimum intervals
      • getMCBMinIntervalsAsSB

        public java.lang.StringBuilder getMCBMinIntervalsAsSB​(double delta)
        Returns a StringBuilder representation of the MCB minimum intervals
        Parameters:
        delta - the indifference zone parameter, must be greater than or equal to zero
        Returns:
        a StringBuilder representation of the MCB minimum intervals
      • getConfidenceIntervalsOfData

        public java.util.List<Interval> getConfidenceIntervalsOfData​(double level)
        A list of confidence intervals for the data based on the supplied confidence level
        Parameters:
        level - the supplied confidence level
        Returns:
        A list of confidence intervals
      • getAllDataAsArray

        public final double[][] getAllDataAsArray()
        A 2-Dim array of the data each row represents the across replication average for each configuration (column)
        Returns:
        2-Dim array of the data each row represents the across replication average for each configuration (column)
      • getData

        public double[] getData​(java.lang.String name)
        The data associated with the name. If the name is not in the map, the array will be null
        Parameters:
        name - the name identifying the data
        Returns:
        the data associated with the name
      • getSummaryStatistics

        public java.lang.StringBuilder getSummaryStatistics()
        Returns a StringBuilder representation of the statistics associated for each data set
        Returns:
        a StringBuilder representation of the statistics associated for each data set
      • getSummaryStatistics

        public java.lang.StringBuilder getSummaryStatistics​(java.lang.String title)
        Returns a StringBuilder representation of the statistics associated for each data set
        Parameters:
        title - a title for the report
        Returns:
        a StringBuilder representation of the statistics associated for each data set
      • getHalfWidthSummaryStatistics

        public java.lang.StringBuilder getHalfWidthSummaryStatistics()
        A half-width summary report on the statistics for each data set
        Returns:
        A half-width summary report on the statistics for each data set
      • getHalfWidthSummaryStatistics

        public java.lang.StringBuilder getHalfWidthSummaryStatistics​(java.lang.String title)
        A half-width summary report on the statistics for each data set
        Parameters:
        title - a title for the report
        Returns:
        A half-width summary report on the statistics for each data set
      • getHalfWidthSummaryStatistics

        public java.lang.StringBuilder getHalfWidthSummaryStatistics​(double level)
        A half-width summary report on the statistics for each data set
        Parameters:
        level - the confidence level
        Returns:
        A half-width summary report on the statistics for each data set
      • getHalfWidthSummaryStatistics

        public java.lang.StringBuilder getHalfWidthSummaryStatistics​(java.lang.String title,
                                                                     double level)
        A half-width summary report on the statistics for each data set
        Parameters:
        title - the title of the report
        level - the confidence level
        Returns:
        A half-width summary report on the statistics for each data set
      • getDifferenceSummaryStatistics

        public java.lang.StringBuilder getDifferenceSummaryStatistics()
        A StringBuilder representation for a summary report on the pairwise differences
        Returns:
        StringBuilder representation for a summary report on the pairwise differences
      • getDifferenceSummaryStatistics

        public java.lang.StringBuilder getDifferenceSummaryStatistics​(java.lang.String title)
        A StringBuilder representation for a summary report on the pairwise differences
        Parameters:
        title - the title of the report
        Returns:
        StringBuilder representation for a summary report on the pairwise differences
      • getHalfWidthDifferenceSummaryStatistics

        public java.lang.StringBuilder getHalfWidthDifferenceSummaryStatistics​(java.lang.String title)
        A StringBuilder representation for a half-width report on the pairwise differences
        Parameters:
        title - the title of the report
        Returns:
        StringBuilder representation for a half-width report on the pairwise differences
      • getHalfWidthDifferenceSummaryStatistics

        public java.lang.StringBuilder getHalfWidthDifferenceSummaryStatistics()
        A StringBuilder representation for a half-width report on the pairwise differences
        Returns:
        StringBuilder representation for a half-width report on the pairwise differences
      • getHalfWidthDifferenceSummaryStatistics

        public java.lang.StringBuilder getHalfWidthDifferenceSummaryStatistics​(double level)
        A StringBuilder representation for a half-width report on the pairwise differences
        Parameters:
        level - the confidence level
        Returns:
        StringBuilder representation for a half-width report on the pairwise differences
      • getHalfWidthDifferenceSummaryStatistics

        public java.lang.StringBuilder getHalfWidthDifferenceSummaryStatistics​(java.lang.String title,
                                                                               double level)
        A StringBuilder representation for a half-width report on the pairwise differences
        Parameters:
        title - the title of the report
        level - the confidence level
        Returns:
        StringBuilder representation for a half-width report on the pairwise differences
      • getConfidenceIntervalsOnData

        public java.lang.StringBuilder getConfidenceIntervalsOnData()
        A StringBuilder representation for the confidence intervals on the datasets at the provided 0.95 level
        Returns:
        tringBuilder representation for the confidence intervals on the datasets at the provided 0.95 level
      • getConfidenceIntervalsOnData

        public java.lang.StringBuilder getConfidenceIntervalsOnData​(double level)
        A StringBuilder representation for the confidence intervals on the datasets at the provided level
        Parameters:
        level - the level
        Returns:
        tringBuilder representation for the confidence intervals
      • getConfidenceIntervalsOnDifferenceData

        public java.lang.StringBuilder getConfidenceIntervalsOnDifferenceData()
        A StringBuilder representation for the confidence intervals on the differences for the datasets at the 0.95 level
        Returns:
        StringBuilder representation for the confidence intervals
      • getConfidenceIntervalsOnDifferenceData

        public java.lang.StringBuilder getConfidenceIntervalsOnDifferenceData​(double level)
        A StringBuilder representation for the confidence intervals on the differences for the datasets at the provided level
        Parameters:
        level - the level
        Returns:
        StringBuilder representation for the confidence intervals
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • writeSummaryStatistics

        public final void writeSummaryStatistics​(java.io.PrintWriter out)
        Write a statistical summary of the data in the analyzer
        Parameters:
        out - the PrintWriter, must not be null
      • writeSummaryDifferenceStatistics

        public final void writeSummaryDifferenceStatistics​(java.io.PrintWriter out)
        Write a statistical summary of the difference data in the analyzer
        Parameters:
        out - the PrintWriter, must not be null
      • writeDataAsCSVFile

        public void writeDataAsCSVFile​(java.io.PrintWriter out)
        Write the data as a csv file
        Parameters:
        out - the PrintWriter, must not be null
      • main

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