Class NormalityTest

java.lang.Object
jdistlib.disttest.NormalityTest

public class NormalityTest extends Object
A package about normality testing. Taken from various places.
  • Constructor Details

    • NormalityTest

      public NormalityTest()
  • Method Details

    • shapiro_wilk_statistic

      public static final double shapiro_wilk_statistic(double[] X)
      Invoke shapiro_wilk_statistic with sort = false
      Parameters:
      X - pre-sorted array of numbers
    • shapiro_wilk_statistic

      public static final double shapiro_wilk_statistic(double[] x, boolean sort)
      Compute Shapiro-Wilk statistic
      Parameters:
      x - array of number
      sort - if true, then this function will attempt to sort the X first.
    • shapiro_wilk_pvalue

      public static final double shapiro_wilk_pvalue(double w, int n)
      Parameters:
      w -
      n - The length of the array
      Returns:
      p value
    • anderson_darling_statistic

      public static final double anderson_darling_statistic(double[] X)
    • anderson_darling_pvalue

      public static final double anderson_darling_pvalue(double value, int n)
      Parameters:
      value -
      n - The length of the array
      Returns:
      p value
    • cramer_vonmises_statistic

      public static final double cramer_vonmises_statistic(double[] X)
    • cramer_vonmises_pvalue

      public static final double cramer_vonmises_pvalue(double w, int n)
      Parameters:
      w -
      n - The length of the array
      Returns:
      p value
    • dagostino_pearson_statistic

      public static final double dagostino_pearson_statistic(double[] X)
      Calculate D'Agostino-Pearson test for normality. Follows Chi^2 distribution with df = 2. This is the infamous omnibus test. Note: It breaks down for n <= 7. See:
      Doornik, Hansen, An Omnibus Test for Univariate and Multivariate Normality, 1994
      Parameters:
      X -
      Returns:
      test statistic
    • dagostino_pearson_pvalue

      public static final double dagostino_pearson_pvalue(double value)
    • jarque_bera_statistic

      public static final double jarque_bera_statistic(double[] X)
      Calculate Jarque-Bera Normality Test. Follows Chi^2 distribution with df = 2
      http://en.wikipedia.org/wiki/Jarque-Bera_test
      Parameters:
      X -
      Returns:
      test statistic
    • jarque_bera_pvalue

      public static final double jarque_bera_pvalue(double value)
    • kolmogorov_smirnov_test

      public static final double[] kolmogorov_smirnov_test(double[] X)
      Perform Kolmogorov-Smirnov two-sided normality test.
      Parameters:
      X -
      Returns:
      an array of two elements: The first is the test statistic, the second is the p-value
    • kolmogorov_smirnov_statistic

      @Deprecated public static final double kolmogorov_smirnov_statistic(double[] X)
      Deprecated.
      Computation of Kolmogorov-Smirnov statistics. Deprecated. Please use kolmogorov_smirnov_test instead.
      Parameters:
      X -
      Returns:
      statistic
    • kolmogorov_smirnov_pvalue

      @Deprecated public static final double kolmogorov_smirnov_pvalue(double d, double[] X)
      Deprecated.
      Computation of Kolmogorov-Smirnov p-value. Deprecated. Please use kolmogorov_smirnov_test instead.
      Parameters:
      d -
      X -
      Returns:
      p-value
    • kolmogorov_lilliefors_statistic

      public static final double kolmogorov_lilliefors_statistic(double[] X)
      Exactly identical as kolmogorov_smirnov_statistic
      Parameters:
      X -
      Returns:
      test statistic
    • kolmogorov_lilliefors_pvalue

      public static final double kolmogorov_lilliefors_pvalue(double k, int n)
      Parameters:
      k -
      n - The length of the array
      Returns:
      p-value
    • shapiro_francia_statistic

      public static final double shapiro_francia_statistic(double[] X)
      Shapiro-Francia normality test
      Parameters:
      X - a sorted array of values
      Returns:
      test statistic
    • shapiro_francia_pvalue

      public static final double shapiro_francia_pvalue(double w, int n)
      P-value of Shapiro-Francia normality test
      Parameters:
      w - the result from ShapiroFrancia's statistic
      n - the length of the original array
      Returns:
      p-value