Class KolmogorovSmirnovTest.TwoResult

    • Method Detail

      • getStatistic

        public double getStatistic()
        Returns the test statistic.

        Ties

        The presence of ties in the data creates a distribution for the D values generated by all possible orderings of the tied regions. This statistic is computed using the path with the minimum effect on the D statistic.

        For a one-sided statistic \(D^+\) or \(D^-\), this is the lower bound of the D statistic.

        For a two-sided statistic D, this may be below the lower bound of the distribution of all possible D values. This case occurs when the number of ties is very high and is identified by a p-value of 1.

        If the two-sided statistic is zero this only occurs in the presence of ties: either the two arrays are identical, are 'identical' data of a single value (sample sizes may be different), or have a sequence of ties of 'identical' data with a net zero effect on the D statistic, e.g.

          [1,2,3]           vs [1,2,3]
          [0,0,0,0]         vs [0,0,0]
          [0,0,0,0,1,1,1,1] vs [0,0,0,1,1,1]
         
        Specified by:
        getStatistic in interface SignificanceResult
        Returns:
        the statistic
      • hasSignificantTies

        public boolean hasSignificantTies()
        Returns true if there were ties between samples that occurred in a region which could change the D statistic if the ties were resolved to a defined order.

        Ties between the data can be interpreted as if the values were different but within machine epsilon. In this case the order within the tie region is not known. If the most extreme ordering of any tied regions (e.g. all tied values of x before all tied values of y) could create a larger D statistic this method will return true.

        If there were no ties, or all possible orderings of tied regions create the same D statistic, this method returns false.

        Note it is possible that this method returns true when D == upperD due to rounding when converting the computed D statistic to a double. This will only occur for large sample sizes n and m where the product n*m >= 2^53.

        Returns:
        true if the D statistic could be changed by resolution of ties
        See Also:
        getUpperD()
      • getUpperD

        public double getUpperD()
        Return the upper bound of the D statistic from all possible paths through regions with ties.

        This will return a value equal to or greater than getStatistic().

        Returns:
        the upper bound of D
        See Also:
        hasSignificantTies()
      • getUpperPValue

        public double getUpperPValue()
        Return the p-value of the upper bound of the D statistic.

        If computed, this will return a value equal to or less than getPValue. It may be orders of magnitude smaller.

        Note: This p-value corresponds to the most extreme p-value from all possible orderings of tied regions. It is not recommended to use this to reject the null hypothesis. The upper bound of D and the corresponding p-value provide information that must be interpreted in the context of the sample data and used to inform a decision on the suitability of the test to the data.

        This value is set to NaN if the p-value was estimated. The estimated p-value will have been created using a distribution of possible D values given the underlying joint distribution of the sample data. Comparison of the p-value to the upper p-value is not applicable.

        Returns:
        the p-value of the upper bound of D (or NaN)
        See Also:
        getUpperD()
      • getPValue

        public double getPValue()
        Description copied from interface: SignificanceResult
        Returns the test statistic p-value.

        The number returned is the smallest significance level at which one can reject the null hypothesis.

        Specified by:
        getPValue in interface SignificanceResult
        Returns:
        the p-value