
public class BetaDistribution extends Object implements DistributionWithRandom
| Modifier and Type | Field and Description | 
|---|---|
private double | 
alpha
Shape parameter of beta distribution 
 | 
private double | 
beta
Shape parameter of beta distribution 
 | 
(package private) static double[] | 
GAUSSLEGENDRE_W
Weights for Gauss-Legendre quadrature 
 | 
(package private) static double[] | 
GAUSSLEGENDRE_Y
Abscissas for Gauss-Legendre quadrature 
 | 
private double | 
logbab
Log beta(a, b) cache 
 | 
(package private) static double | 
NUM_PRECISION
Numerical precision to use 
 | 
private Random | 
random
For random number generation 
 | 
(package private) static double | 
SWITCH
Limit of when to switch to quadrature method 
 | 
| Constructor and Description | 
|---|
BetaDistribution(double a,
                double b)
Constructor. 
 | 
BetaDistribution(double a,
                double b,
                Random random)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
double | 
cdf(double x)
Return the cumulative density function at the given value. 
 | 
static double | 
cdf(double val,
   double alpha,
   double beta)
Static version of the CDF of the beta distribution 
 | 
static double | 
logBeta(double alpha,
       double beta)
Compute log beta(a,b) 
 | 
double | 
nextRandom()
Generate a new random value 
 | 
double | 
pdf(double val)
Return the density of an existing value 
 | 
static double | 
pdf(double val,
   double alpha,
   double beta)
Static version of the PDF of the beta distribution 
 | 
double | 
quantile(double x)
Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function. 
 | 
static double | 
quantile(double p,
        double alpha,
        double beta)
Compute quantile (inverse cdf) for Beta distributions. 
 | 
protected static double | 
rawQuantile(double p,
           double alpha,
           double beta,
           double logbeta)
Raw quantile function 
 | 
static double | 
regularizedIncBeta(double x,
                  double alpha,
                  double beta)
Computes the regularized incomplete beta function I_x(a, b) which is also
 the CDF of the beta distribution. 
 | 
protected static double | 
regularizedIncBetaCF(double alpha,
                    double beta,
                    double x)
Returns the regularized incomplete beta function I_x(a, b) Includes the
 continued fraction way of computing, based on the book "Numerical Recipes". 
 | 
protected static double | 
regularizedIncBetaQuadrature(double alpha,
                            double beta,
                            double x)
Returns the regularized incomplete beta function I_x(a, b) by quadrature,
 based on the book "Numerical Recipes". 
 | 
String | 
toString()
Describe the distribution 
 | 
static final double NUM_PRECISION
static final double SWITCH
static final double[] GAUSSLEGENDRE_Y
static final double[] GAUSSLEGENDRE_W
private final double alpha
private final double beta
private Random random
private double logbab
public BetaDistribution(double a,
                double b)
a - shape Parameter ab - shape Parameter bpublic BetaDistribution(double a,
                double b,
                Random random)
a - shape Parameter ab - shape Parameter brandom - Random generatorpublic double pdf(double val)
Distributionpdf in interface Distributionval - existing valuepublic double cdf(double x)
Distributioncdf in interface Distributionx - existing valuepublic double quantile(double x)
Distributionquantile in interface Distributionx - Quantile to findpublic double nextRandom()
DistributionWithRandomnextRandom in interface DistributionWithRandompublic String toString()
DistributiontoString in interface DistributiontoString in class Objectpublic static double cdf(double val,
         double alpha,
         double beta)
val - Valuealpha - Shape parameter abeta - Shape parameter bpublic static double pdf(double val,
         double alpha,
         double beta)
val - Valuealpha - Shape parameter abeta - Shape parameter bpublic static double logBeta(double alpha,
             double beta)
alpha - Shape parameter abeta - Shape parameter bpublic static double regularizedIncBeta(double x,
                        double alpha,
                        double beta)
alpha - Parameter abeta - Parameter bx - Parameter xprotected static double regularizedIncBetaCF(double alpha,
                          double beta,
                          double x)
alpha - Parameter abeta - Parameter bx - Parameter xprotected static double regularizedIncBetaQuadrature(double alpha,
                                  double beta,
                                  double x)
alpha - Parameter abeta - Parameter bx - Parameter xpublic static double quantile(double p,
              double alpha,
              double beta)
p - Probabilityalpha - Shape parameter abeta - Shape parameter bprotected static double rawQuantile(double p,
                 double alpha,
                 double beta,
                 double logbeta)
p - P, must be 0 < p <= .5alpha - Alphabeta - Betalogbeta - log Beta(alpha, beta)