程序包 weka.core

类 Statistics

java.lang.Object
weka.core.Statistics
所有已实现的接口:
RevisionHandler

public class Statistics extends Object implements RevisionHandler
Class implementing some distributions, tests, etc. The code is mostly adapted from the CERN Jet Java libraries: Copyright 2001 University of Waikato Copyright 1999 CERN - European Organization for Nuclear Research. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. CERN and the University of Waikato make no representations about the suitability of this software for any purpose. It is provided "as is" without expressed or implied warranty.
版本:
$Revision: 5619 $
作者:
peter.gedeck@pharma.Novartis.com, wolfgang.hoschek@cern.ch, Eibe Frank (eibe@cs.waikato.ac.nz), Richard Kirkby (rkirkby@cs.waikato.ac.nz)
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static double
    binomialStandardError(double p, int n)
    Computes standard error for observed values of a binomial random variable.
    static double
    chiSquaredProbability(double x, double v)
    Returns chi-squared probability for given value and degrees of freedom.
    static double
    errorFunction(double x)
    Returns the error function of the normal distribution.
    static double
    Returns the complementary Error function of the normal distribution.
    static double
    FProbability(double F, int df1, int df2)
    Computes probability of F-ratio.
    static double
    gamma(double x)
    Returns the Gamma function of the argument.
    Returns the revision string.
    static double
    incompleteBeta(double aa, double bb, double xx)
    Returns the Incomplete Beta Function evaluated from zero to xx.
    static double
    incompleteBetaFraction1(double a, double b, double x)
    Continued fraction expansion #1 for incomplete beta integral.
    static double
    incompleteBetaFraction2(double a, double b, double x)
    Continued fraction expansion #2 for incomplete beta integral.
    static double
    incompleteGamma(double a, double x)
    Returns the Incomplete Gamma function.
    static double
    incompleteGammaComplement(double a, double x)
    Returns the Complemented Incomplete Gamma function.
    static double
    lnGamma(double x)
    Returns natural logarithm of gamma function.
    static void
    main(String[] ops)
    Main method for testing this class.
    static double
    normalInverse(double y0)
    Returns the value, x, for which the area under the Normal (Gaussian) probability density function (integrated from minus infinity to x) is equal to the argument y (assumes mean is zero, variance is one).
    static double
    Returns the area under the Normal (Gaussian) probability density function, integrated from minus infinity to x (assumes mean is zero, variance is one).
    static double
    p1evl(double x, double[] coef, int N)
    Evaluates the given polynomial of degree N at x.

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • Statistics

      public Statistics()
  • 方法详细资料

    • binomialStandardError

      public static double binomialStandardError(double p, int n)
      Computes standard error for observed values of a binomial random variable.
      参数:
      p - the probability of success
      n - the size of the sample
      返回:
      the standard error
    • chiSquaredProbability

      public static double chiSquaredProbability(double x, double v)
      Returns chi-squared probability for given value and degrees of freedom. (The probability that the chi-squared variate will be greater than x for the given degrees of freedom.)
      参数:
      x - the value
      v - the number of degrees of freedom
      返回:
      the chi-squared probability
    • FProbability

      public static double FProbability(double F, int df1, int df2)
      Computes probability of F-ratio.
      参数:
      F - the F-ratio
      df1 - the first number of degrees of freedom
      df2 - the second number of degrees of freedom
      返回:
      the probability of the F-ratio.
    • normalProbability

      public static double normalProbability(double a)
      Returns the area under the Normal (Gaussian) probability density function, integrated from minus infinity to x (assumes mean is zero, variance is one).
                                  x
                                   -
                         1        | |          2
        normal(x)  = ---------    |    exp( - t /2 ) dt
                     sqrt(2pi)  | |
                                 -
                                -inf.
      
                   =  ( 1 + erf(z) ) / 2
                   =  erfc(z) / 2
       
      where z = x/sqrt(2). Computation is via the functions errorFunction and errorFunctionComplement.
      参数:
      a - the z-value
      返回:
      the probability of the z value according to the normal pdf
    • normalInverse

      public static double normalInverse(double y0)
      Returns the value, x, for which the area under the Normal (Gaussian) probability density function (integrated from minus infinity to x) is equal to the argument y (assumes mean is zero, variance is one).

      For small arguments 0 < y < exp(-2), the program computes z = sqrt( -2.0 * log(y) ); then the approximation is x = z - log(z)/z - (1/z) P(1/z) / Q(1/z). There are two rational functions P/Q, one for 0 < y < exp(-32) and the other for y up to exp(-2). For larger arguments, w = y - 0.5, and x/sqrt(2pi) = w + w**3 R(w**2)/S(w**2)).

      参数:
      y0 - the area under the normal pdf
      返回:
      the z-value
    • lnGamma

      public static double lnGamma(double x)
      Returns natural logarithm of gamma function.
      参数:
      x - the value
      返回:
      natural logarithm of gamma function
    • errorFunction

      public static double errorFunction(double x)
      Returns the error function of the normal distribution. The integral is
                                 x 
                                  -
                       2         | |          2
         erf(x)  =  --------     |    exp( - t  ) dt.
                    sqrt(pi)   | |
                                -
                                 0
       
      Implementation: For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise erf(x) = 1 - erfc(x).

      Code adapted from the Java 2D Graph Package 2.4, which in turn is a port from the Cephes 2.2 Math Library (C).

      参数:
      a - the argument to the function.
    • errorFunctionComplemented

      public static double errorFunctionComplemented(double a)
      Returns the complementary Error function of the normal distribution.
        1 - erf(x) =
      
                                 inf. 
                                   -
                        2         | |          2
         erfc(x)  =  --------     |    exp( - t  ) dt
                     sqrt(pi)   | |
                                 -
                                  x
       
      Implementation: For small x, erfc(x) = 1 - erf(x); otherwise rational approximations are computed.

      Code adapted from the Java 2D Graph Package 2.4, which in turn is a port from the Cephes 2.2 Math Library (C).

      参数:
      a - the argument to the function.
    • p1evl

      public static double p1evl(double x, double[] coef, int N)
      Evaluates the given polynomial of degree N at x. Evaluates polynomial when coefficient of N is 1.0. Otherwise same as polevl().
                           2          N
       y  =  C  + C x + C x  +...+ C x
              0    1     2          N
      
       Coefficients are stored in reverse order:
      
       coef[0] = C  , ..., coef[N] = C  .
                  N                   0
       
      The function p1evl() assumes that coef[N] = 1.0 and is omitted from the array. Its calling arguments are otherwise the same as polevl().

      In the interest of speed, there are no checks for out of bounds arithmetic.

      参数:
      x - argument to the polynomial.
      coef - the coefficients of the polynomial.
      N - the degree of the polynomial.
    • incompleteGamma

      public static double incompleteGamma(double a, double x)
      Returns the Incomplete Gamma function.
      参数:
      a - the parameter of the gamma distribution.
      x - the integration end point.
    • incompleteGammaComplement

      public static double incompleteGammaComplement(double a, double x)
      Returns the Complemented Incomplete Gamma function.
      参数:
      a - the parameter of the gamma distribution.
      x - the integration start point.
    • gamma

      public static double gamma(double x)
      Returns the Gamma function of the argument.
    • incompleteBeta

      public static double incompleteBeta(double aa, double bb, double xx)
      Returns the Incomplete Beta Function evaluated from zero to xx.
      参数:
      aa - the alpha parameter of the beta distribution.
      bb - the beta parameter of the beta distribution.
      xx - the integration end point.
    • incompleteBetaFraction1

      public static double incompleteBetaFraction1(double a, double b, double x)
      Continued fraction expansion #1 for incomplete beta integral.
    • incompleteBetaFraction2

      public static double incompleteBetaFraction2(double a, double b, double x)
      Continued fraction expansion #2 for incomplete beta integral.
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision
    • main

      public static void main(String[] ops)
      Main method for testing this class.