org.lcsim.util
Class ChisqProb

java.lang.Object
  extended byorg.lcsim.util.ChisqProb

public class ChisqProb
extends java.lang.Object

A utility class to return the probability that a value of chi-squared x measured for a system with n degrees of freedom would be exceeded by chance. Based on routines in the book "Numerical Recipes: The Art of Scientific Computing".

Author:
Norman Graf

Constructor Summary
ChisqProb()
           
 
Method Summary
static double gammln(double x)
          Returns the logarithm of the Gamma function of x, for x>0.
static double gammp(int a, double x)
          Returns the incomplete gamma function P(a, x).
static double gammq(int a, double x)
          Returns the incomplete gamma function Q(a, x)= 1 - P(a, x).
static double gcf(double a, double x)
          Returns the incomplete gamma function Q(a, x) evaluated by its continued fraction representation.
static double gser(double a, double x)
          Returns the incomplete gamma function P(a, x) evaluated by its series representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChisqProb

public ChisqProb()
Method Detail

gammp

public static double gammp(int a,
                           double x)
Returns the incomplete gamma function P(a, x).
P(a,x) º g(a,x)
G(a)
º 1
G(a)
x
ó
õ
0 
e - t ta - 1 dt
This is the probability that the observed chi-square for a correct model should be less than a value of chi-square.

Returns:
The incomplete gamma function P(a, x).

gammq

public static double gammq(int a,
                           double x)
Returns the incomplete gamma function Q(a, x)= 1 - P(a, x).
Q(a,x) º 1 - P(a,x) º G(a,x)
G(a)
¥
ó
õ
x 
e - t ta - 1 dt
This is the probability that the observed chi-square will exceed the value of chi-square by chance even for a correct model.

Returns:
The incomplete gamma function Q(a, x)= 1 - P(a, x).

gser

public static double gser(double a,
                          double x)
Returns the incomplete gamma function P(a, x) evaluated by its series representation.
g(a,x) = e - x xa ¥
å
n = 0 
 G(a)

G(a + 1 + n)
xn

Returns:
The incomplete gamma P(a, x) evaluated by its series representation.

gcf

public static double gcf(double a,
                         double x)
Returns the incomplete gamma function Q(a, x) evaluated by its continued fraction representation.
G(a,x) = e - x xa æ
è
 1

x +
 1 - a

1 +
 1

x +
 2 - a

1 +
 2

x +
¼ ö
ø
   (x > 0)

Returns:
The incomplete gamma Q(a, x) evaluated by its continued fraction representation.

gammln

public static double gammln(double x)
Returns the logarithm of the Gamma function of x, for x>0.
G(z) = ¥
ó
õ
0 
tz - 1 e - t dt

Returns:
The value ln(Gamma(x))