Documentation of 'jdistlib.disttest.DistributionTest' Java class
DistributionTest
jdistlib.disttest

Class DistributionTest



  • public class DistributionTest
    extends java.lang.Object
    Comparing two distributions
    • Constructor Summary

      Constructors 
      Constructor and Description
      DistributionTest() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double[] ansari_bradley_test(double[] x, double[] y, boolean force_exact)
      Return the two-sided test of Ansari-Bradley.
      static double[] ansari_bradley_test(double[] x, double[] y, boolean force_exact, TestKind kind)
      Ansari-Bradley test.
      static double[] bartlett_test(double[] x, int[] group)
      Bartlett's test
      static double[] binomial_test(int n_success, int n, double p, TestKind kind)
      Binomial test
      static double[] diptest_presorted(double[] x)
      Perform Hartigan's dip test, assuming the minimum test statistics D is zero.
      static double[] diptest(double[] x)
      Perform Hartigan's dip test, assuming the minimum test statistics D is zero.
      static double[] fligner_test(double[] x, int[] group)
      Fligner-Killeen test
      static double[] kolmogorov_smirnov_test(double[] X, double[] Y)
      Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided, exact p-value.
      static double[] kolmogorov_smirnov_test(double[] X, double[] Y, boolean isExact)
      Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided.
      static double[] kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind)
      Compute the Kolmogorov-Smirnov test to test between two distribution, exact p-value.
      static double[] kolmogorov_smirnov_test(double[] X, double[] Y, TestKind kind, boolean isExact)
      Compute the Kolmogorov-Smirnov test to test between two distribution.
      static double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist)
      Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided, exact p-value.
      static double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, boolean isExact)
      Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided.
      static double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind)
      Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, exact p-value.
      static double[] kolmogorov_smirnov_test(double[] X, GenericDistribution dist, TestKind kind, boolean isExact)
      Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution.
      static double[] kruskal_wallis_test(double[] x, int[] group)
      Kruskal-Wallis test
      static void main(java.lang.String[] args) 
      static double[] mann_whitney_u_test(double[] x, double[] y, double mu, boolean correction, boolean paired, TestKind kind)
      Mann-Whitney-U test
      static double[] mood_test(double[] x, double[] y)
      Performs Mood's two-sample test for a difference in scale parameters.
      static double[] mood_test(double[] x, double[] y, TestKind kind)
      Performs Mood's two-sample test for a difference in scale parameters.
      static double[] poisson_test(int num_events, double time, double rate, TestKind kind)
      Performs an exact test of a simple null hypothesis about the rate parameter in Poisson distribution
      static double[] poisson_test(int num_events1, int num_events2, double time1, double time2, double r, TestKind kind)
      Comparison of Poisson rates
      static double[] t_test_paired(double[] x, double[] y, double mu, TestKind kind)
      Paired t-test
      static double[] t_test(double[] x, double[] y, double mu, boolean pool_var, TestKind kind)
      Two sample t-test
      static double[] t_test(double[] x, double mu, TestKind kind)
      One-sample t-test
      static double[] var_test(double[] x, double[] y, double ratio, TestKind kind)
      Performs an F test to compare the variances of two samples from normal populations.
      static double[] var_test(double[] x, double[] y, TestKind kind)
      Performs an F test to compare the variances of two samples from normal populations.
      static double[] wilcoxon_test(double[] x, double mu, boolean correction, TestKind kind)
      One-sample Wilcoxon test.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DistributionTest

        public DistributionTest()
    • Method Detail

      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             double[] Y)
        Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided, exact p-value. If there are ties, then p-values will be inexact!
        Parameters:
        X - an array with length of nX
        Y - an array with length of nY
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             double[] Y,
                                                             boolean isExact)
        Compute the Kolmogorov-Smirnov test to test between two distribution, two-sided.
        Parameters:
        X - an array with length of nX
        Y - an array with length of nY
        isExact - whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             double[] Y,
                                                             TestKind kind)
        Compute the Kolmogorov-Smirnov test to test between two distribution, exact p-value. If there are ties, then p-values will be inexact!
        Parameters:
        X - an array with length of nX
        Y - an array with length of nY
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             double[] Y,
                                                             TestKind kind,
                                                             boolean isExact)
        Compute the Kolmogorov-Smirnov test to test between two distribution.
        Parameters:
        X - an array with length of nX
        Y - an array with length of nY
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        isExact - whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             GenericDistribution dist)
        Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided, exact p-value. If there are ties, then p-values will be inexact!
        Parameters:
        X - an array with length of nX
        dist - reference distribution
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             GenericDistribution dist,
                                                             TestKind kind)
        Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, exact p-value. If there are ties, then p-values will be inexact!
        Parameters:
        X - an array with length of nX
        dist - reference distribution
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             GenericDistribution dist,
                                                             boolean isExact)
        Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution, two-sided.
        Parameters:
        X - an array with length of nX
        dist - reference distribution
        isExact - whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kolmogorov_smirnov_test

        public static final double[] kolmogorov_smirnov_test(double[] X,
                                                             GenericDistribution dist,
                                                             TestKind kind,
                                                             boolean isExact)
        Compute the Kolmogorov-Smirnov test to test between X and a known reference distribution.
        Parameters:
        X - an array with length of nX
        dist - reference distribution
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        isExact - whether the p-value should be computed with the exact method or not (takes a long time). If there are ties, this option is ignored.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • ansari_bradley_test

        public static final double[] ansari_bradley_test(double[] x,
                                                         double[] y,
                                                         boolean force_exact)
        Return the two-sided test of Ansari-Bradley.
        Parameters:
        x - the original x
        y - the original y
        force_exact - Set to true if you want exact answer. The default behavior is that if there are ties or either the length of x or the length of y is at least 50.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • ansari_bradley_test

        public static final double[] ansari_bradley_test(double[] x,
                                                         double[] y,
                                                         boolean force_exact,
                                                         TestKind kind)
        Ansari-Bradley test.
        Parameters:
        x - the original x
        y - the original y
        force_exact - Set to true if you want exact answer. The default behavior is that if there are ties or either the length of x or the length of y is at least 50.
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • mood_test

        public static final double[] mood_test(double[] x,
                                               double[] y)
        Performs Mood's two-sample test for a difference in scale parameters. Two-sided test.
        Parameters:
        x -
        y -
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • mood_test

        public static final double[] mood_test(double[] x,
                                               double[] y,
                                               TestKind kind)
        Performs Mood's two-sample test for a difference in scale parameters.
        Parameters:
        x -
        y -
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • var_test

        public static final double[] var_test(double[] x,
                                              double[] y,
                                              TestKind kind)
        Performs an F test to compare the variances of two samples from normal populations. Ratio is set to 1.0.
        Parameters:
        x -
        y -
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • var_test

        public static final double[] var_test(double[] x,
                                              double[] y,
                                              double ratio,
                                              TestKind kind)
        Performs an F test to compare the variances of two samples from normal populations.
        Parameters:
        x -
        y -
        ratio - the hypothesized ratio of the population variances of x and y.
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • wilcoxon_test

        public static final double[] wilcoxon_test(double[] x,
                                                   double mu,
                                                   boolean correction,
                                                   TestKind kind)
        One-sample Wilcoxon test. Test whether the vector of x is != mu
        Parameters:
        x -
        mu -
        correction - set to true if continuity correction is desired. Only matters if x has zeroes or ties
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • mann_whitney_u_test

        public static final double[] mann_whitney_u_test(double[] x,
                                                         double[] y,
                                                         double mu,
                                                         boolean correction,
                                                         boolean paired,
                                                         TestKind kind)
        Mann-Whitney-U test
        Parameters:
        x -
        y -
        mu -
        correction - set to true if continuity correction is desired. Only matters then there are ties
        paired - set to true for paired test (which reduces to Wilcoxon test)
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • t_test

        public static final double[] t_test(double[] x,
                                            double mu,
                                            TestKind kind)
        One-sample t-test
        Parameters:
        x -
        mu -
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • t_test_paired

        public static final double[] t_test_paired(double[] x,
                                                   double[] y,
                                                   double mu,
                                                   TestKind kind)
        Paired t-test
        Parameters:
        x -
        y -
        mu -
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • t_test

        public static final double[] t_test(double[] x,
                                            double[] y,
                                            double mu,
                                            boolean pool_var,
                                            TestKind kind)
        Two sample t-test
        Parameters:
        x -
        y -
        mu -
        pool_var - set to true if the variance should be pooled. Only matters when paired == false
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • binomial_test

        public static final double[] binomial_test(int n_success,
                                                   int n,
                                                   double p,
                                                   TestKind kind)
        Binomial test
        Parameters:
        n_success - The number of successes
        n - The total number of trials
        p - Expected probability
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • bartlett_test

        public static final double[] bartlett_test(double[] x,
                                                   int[] group)
        Bartlett's test
        Parameters:
        x -
        group - an array of group indices. Observation in x that belongs in the same group must have the same index.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • fligner_test

        public static final double[] fligner_test(double[] x,
                                                  int[] group)
        Fligner-Killeen test
        Parameters:
        x -
        group - an array of group indices. Observation in x that belongs in the same group must have the same index.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • kruskal_wallis_test

        public static final double[] kruskal_wallis_test(double[] x,
                                                         int[] group)
        Kruskal-Wallis test
        Parameters:
        x -
        group - an array of group indices. Observation in x that belongs in the same group must have the same index.
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • poisson_test

        public static final double[] poisson_test(int num_events,
                                                  double time,
                                                  double rate,
                                                  TestKind kind)
        Performs an exact test of a simple null hypothesis about the rate parameter in Poisson distribution
        Parameters:
        num_events - number of events.
        time - time base for event count.
        rate - hypothesized rate
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • poisson_test

        public static final double[] poisson_test(int num_events1,
                                                  int num_events2,
                                                  double time1,
                                                  double time2,
                                                  double r,
                                                  TestKind kind)
        Comparison of Poisson rates
        Parameters:
        num_events1 - number of events for the treatment.
        num_events2 - number of events for control.
        time1 - time base for event count for treatment.
        time2 - time base for event count for control.
        kind - the kind of test {LOWER, GREATER, TWO_SIDED}
        Returns:
        an array of two elements: The first is the test statistic, the second is the p-value
      • diptest

        public static final double[] diptest(double[] x)
        Perform Hartigan's dip test, assuming the minimum test statistics D is zero.
        Parameters:
        x - Can be of any order. If x is already sorted, use diptest_presorted to save some time.
        Returns:
        an array of four elements: The first is the test statistic, the second is the p-value, followed by indices for which there are a dip. If there is no dip, the indices will be set to -1.
      • diptest_presorted

        public static final double[] diptest_presorted(double[] x)
        Perform Hartigan's dip test, assuming the minimum test statistics D is zero.
        Parameters:
        x - MUST BE SORTED in order to output the right result. This routine will NOT check for order!
        Returns:
        an array of four elements: The first is the test statistic, the second is the p-value, followed by indices for which there are a dip. If there is no dip, the indices will be set to -1.
      • main

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

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.