blog.distrib
Class Beta

java.lang.Object
  extended by blog.AbstractCondProbDistrib
      extended by blog.distrib.Beta
All Implemented Interfaces:
CondProbDistrib

public class Beta
extends AbstractCondProbDistrib

A Beta distribution with shape parameters a and b, defined by f(x) =(x^(a-1) * (1-x)^(b-1)) / B(a,b) where B(a,b) is a normalization constant equal to integral from 0 to 1 of x^(a-1) * (1-x)^(b-1) dx


Constructor Summary
Beta(java.util.List params)
          Returns a new Beta with shape parameters a and b.
 
Method Summary
static double beta(double a, double b)
          Returns the Beta function of reals a and b B(a,b) = Gamma(a)Gamma(b) / Gamma(a+b) Reference: Numerical Recipes in C http://www.library.cornell.edu/nr/cbookcpdf.html
 double getLogProb(java.util.List args, java.lang.Object value)
          Returns the log of the probability of value under this distribution.
 double getProb(java.util.List args, java.lang.Object value)
          Returns the probability of value under this distribution.
 java.lang.Object sampleVal(java.util.List args, Type childType)
          Returns a double sampled according to this distribution.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Beta

public Beta(java.util.List params)
Returns a new Beta with shape parameters a and b.

Method Detail

getProb

public double getProb(java.util.List args,
                      java.lang.Object value)
Returns the probability of value under this distribution.


getLogProb

public double getLogProb(java.util.List args,
                         java.lang.Object value)
Returns the log of the probability of value under this distribution.

Specified by:
getLogProb in interface CondProbDistrib
Overrides:
getLogProb in class AbstractCondProbDistrib

sampleVal

public java.lang.Object sampleVal(java.util.List args,
                                  Type childType)
Returns a double sampled according to this distribution. Takes time equivalent to the distrib.Gamma sampling function. (Reference: A Guide To Simulation, 2nd Ed. Bratley, Paul, Bennett L. Fox and Linus E. Schrage.)


beta

public static double beta(double a,
                          double b)
Returns the Beta function of reals a and b B(a,b) = Gamma(a)Gamma(b) / Gamma(a+b) Reference: Numerical Recipes in C http://www.library.cornell.edu/nr/cbookcpdf.html


toString

public java.lang.String toString()
Overrides:
toString in class AbstractCondProbDistrib