edu.northwestern.at.utils.math.distributions
Class Beta

java.lang.Object
  extended by edu.northwestern.at.utils.math.distributions.Beta

public class Beta
extends java.lang.Object

Beta distribution functions.


Constructor Summary
protected Beta()
          Make class non-instantiable but inheritable.
 
Method Summary
static double beta(double a, double b)
          Beta function.
static double incompleteBeta(double x, double alpha, double beta)
          Cumulative probability density function for the incomplete beta function.
static double incompleteBeta(double x, double alpha, double beta, int dPrec)
          Cumulative probability density function for the incomplete beta function.
static double incompleteBetaInverse(double p, double alpha, double beta)
          Compute value of inverse incomplete beta distribution.
static double logBeta(double a, double b)
          Log of the Beta distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Beta

protected Beta()
Make class non-instantiable but inheritable.

Method Detail

logBeta

public static double logBeta(double a,
                             double b)
Log of the Beta distribution.

Parameters:
a -
b -
Returns:
Log of the Beta distribution for specofied parameters.

The log of the beta distribution is calculated from the log of the gamma distribution using the following relationship:

logBeta(a,b) = logGamma(a) + logGamma(b) - logGamma( a + b )


beta

public static double beta(double a,
                          double b)
                   throws java.lang.ArithmeticException
Beta function.

Parameters:
a -
b -
Returns:
Beta distribution for specified arguments.

The beta distribution value is calculated from the gamma distribution using the following relationship:

Beta(a,b) = ( Gamma(a) * Gamma(b) ) / Gamma( a + b )

Throws:
java.lang.ArithmeticException

incompleteBeta

public static double incompleteBeta(double x,
                                    double alpha,
                                    double beta,
                                    int dPrec)
                             throws java.lang.IllegalArgumentException
Cumulative probability density function for the incomplete beta function.

Parameters:
x - Upper percentage point of incomplete beta probability density function
alpha - First shape parameter
beta - Second shape parameter
dPrec - Digits of precision desired (1 < dPrec < Constants.MAXPREC)
Returns:
Cumulative probability density function value.
Throws:
java.lang.IllegalArgumentException - if x <= 0 or a <= 0 or b <= 0 .

The continued fraction expansion as given by Abramowitz and Stegun (1964) is used. This method works well unless the minimum of (alpha, beta) exceeds about 70000. For most common values the result will be accurate to about 14 decimal digits.


incompleteBeta

public static double incompleteBeta(double x,
                                    double alpha,
                                    double beta)
                             throws java.lang.IllegalArgumentException
Cumulative probability density function for the incomplete beta function.

Parameters:
x - Upper percentage point of incomplete beta probability density function
alpha - First shape parameter
beta - Second shape parameter
Returns:
Cumulative probability density function value.
Throws:
java.lang.IllegalArgumentException - if x <= 0 or a <= 0 or b <= 0 .

The continued fraction expansion as given by Abramowitz and Stegun (1964) is used. This method works well unless the minimum of (alpha, beta) exceeds about 70000. For most common values the result will be accurate to about 14 decimal digits.


incompleteBetaInverse

public static double incompleteBetaInverse(double p,
                                           double alpha,
                                           double beta)
                                    throws java.lang.IllegalArgumentException
Compute value of inverse incomplete beta distribution.

Parameters:
p - Probability value.
alpha - First shape parameter.
beta - Second shape parameter.
Returns:
Percentage point of inverse beta distribution.
Throws:
java.lang.IllegalArgumentException - if alpha <= 0 or beta <= 0 or p <= 0 or p >= 1 .