@PublicationReference(author="Wikipedia", title="Beta distribution", type=WebPage, year=2009, url="http://en.wikipedia.org/wiki/Beta_distribution") public class BetaDistribution extends AbstractClosedFormSmoothUnivariateDistribution implements EstimableDistribution<java.lang.Double,BetaDistribution>
Modifier and Type | Class and Description |
---|---|
static class |
BetaDistribution.CDF
CDF of the Beta-family distribution
|
static class |
BetaDistribution.MomentMatchingEstimator
Estimates the parameters of a Beta distribution using the matching
of moments, not maximum likelihood.
|
static class |
BetaDistribution.PDF
Beta distribution probability density function
|
static class |
BetaDistribution.WeightedMomentMatchingEstimator
Estimates the parameters of a Beta distribution using the matching
of moments, not maximum likelihood.
|
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_ALPHA
Default alpha, 2.0.
|
static double |
DEFAULT_BETA
Default beta, 2.0.
|
Constructor and Description |
---|
BetaDistribution()
Default constructor.
|
BetaDistribution(BetaDistribution other)
Copy Constructor
|
BetaDistribution(double alpha,
double beta)
Creates a new instance of BetaDistribution
|
Modifier and Type | Method and Description |
---|---|
BetaDistribution |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Sets the parameters of the distribution
|
Vector |
convertToVector()
Gets the parameters of the distribution
|
double |
getAlpha()
Getter for alpha
|
double |
getBeta()
Getter for beta
|
BetaDistribution.CDF |
getCDF()
Gets the CDF of a scalar distribution.
|
BetaDistribution.MomentMatchingEstimator |
getEstimator()
Gets an estimator associated with this distribution.
|
java.lang.Double |
getMaxSupport()
Gets the minimum support (domain or input) of the distribution.
|
double |
getMeanAsDouble()
Gets the mean of the distribution as a double.
|
java.lang.Double |
getMinSupport()
Gets the minimum support (domain or input) of the distribution.
|
BetaDistribution.PDF |
getProbabilityFunction()
Gets the distribution function associated with this Distribution,
either the PDF or PMF.
|
double |
getVariance()
Gets the variance of the distribution.
|
double |
sampleAsDouble(java.util.Random random)
Samples a value from this distribution as a double.
|
void |
sampleInto(java.util.Random random,
double[] output,
int start,
int length)
Samples values from this distribution as an array of doubles.
|
void |
setAlpha(double alpha)
Setter for alpha
|
void |
setBeta(double beta)
Setter for beta
|
getMean, sampleAsDoubles, sampleInto
sample, sample
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sample, sample, sampleInto
public static final double DEFAULT_ALPHA
public static final double DEFAULT_BETA
public BetaDistribution()
public BetaDistribution(double alpha, double beta)
alpha
- Alpha shape parameter, must be greater than 0 (typically greater than 1)beta
- Beta shape parameter, must be greater than 0 (typically greater than 1)public BetaDistribution(BetaDistribution other)
other
- BetaDistribution to copypublic BetaDistribution clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface Vectorizable
clone
in interface CloneableSerializable
clone
in class AbstractClosedFormUnivariateDistribution<java.lang.Double>
public double getMeanAsDouble()
UnivariateDistribution
getMeanAsDouble
in interface UnivariateDistribution<java.lang.Double>
public double getVariance()
UnivariateDistribution
getVariance
in interface UnivariateDistribution<java.lang.Double>
public double sampleAsDouble(java.util.Random random)
SmoothUnivariateDistribution
sampleAsDouble
in interface SmoothUnivariateDistribution
sampleAsDouble
in class AbstractClosedFormSmoothUnivariateDistribution
random
- Random number generator to use.public void sampleInto(java.util.Random random, double[] output, int start, int length)
SmoothUnivariateDistribution
sampleInto
in interface SmoothUnivariateDistribution
random
- Random number generator to use.output
- The array to write the result into. Cannot be null.start
- The offset in the array to start writing at. Cannot be negative.length
- The number of values to sample. Cannot be negative.public Vector convertToVector()
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
convertFromVector
in interface Vectorizable
parameters
- 2-dimensional Vector with [alpha beta]public double getAlpha()
public void setAlpha(double alpha)
alpha
- Alpha shape parameter, must be greater than 0 (typically greater than 1)public double getBeta()
public void setBeta(double beta)
beta
- Beta shape parameter, must be greater than 0 (typically greater than 1)public BetaDistribution.CDF getCDF()
UnivariateDistribution
getCDF
in interface ClosedFormUnivariateDistribution<java.lang.Double>
getCDF
in interface SmoothUnivariateDistribution
getCDF
in interface UnivariateDistribution<java.lang.Double>
public BetaDistribution.PDF getProbabilityFunction()
ComputableDistribution
getProbabilityFunction
in interface ComputableDistribution<java.lang.Double>
getProbabilityFunction
in interface SmoothUnivariateDistribution
public java.lang.Double getMinSupport()
UnivariateDistribution
getMinSupport
in interface UnivariateDistribution<java.lang.Double>
public java.lang.Double getMaxSupport()
UnivariateDistribution
getMaxSupport
in interface UnivariateDistribution<java.lang.Double>
public BetaDistribution.MomentMatchingEstimator getEstimator()
EstimableDistribution
getEstimator
in interface EstimableDistribution<java.lang.Double,BetaDistribution>