| Modifier and Type | Class and Description |
|---|---|
| private static class | BetaDistribution.
Utility class implementing Cheng's algorithms for beta distribution sampling. |
| Modifier and Type | Field and Description |
|---|---|
| private final double | alpha
First shape parameter. |
| private final double | beta
Second shape parameter. |
| public static final double | DEFAULT_INVERSE_ABSOLUTE_ACCURACY
Default inverse cumulative probability accuracy. |
| private static final long | serialVersionUID
Hides org. |
| private final double | solverAbsoluteAccuracy
Hides org. |
| private double | z
Normalizing factor used in density computations. |
| Access | Constructor and Description |
|---|---|
| public | BetaDistribution(double
First shape parameter (must be positive). alpha, double Second shape parameter (must be positive). beta)Build a new instance. |
| public | BetaDistribution(double
First shape parameter (must be positive). alpha, double Second shape parameter (must be positive). beta, double Maximum absolute error in inverse
cumulative probability estimates (defaults to
inverseCumAccuracy)DEFAULT_INVERSE_ABSOLUTE_ACCURACY).Build a new instance. |
| public | BetaDistribution(RandomGenerator
Random number generator. rng, double First shape parameter (must be positive). alpha, double Second shape parameter (must be positive). beta)Creates a β distribution. |
| public | BetaDistribution(RandomGenerator
Random number generator. rng, double First shape parameter (must be positive). alpha, double Second shape parameter (must be positive). beta, double Maximum absolute error in inverse
cumulative probability estimates (defaults to
inverseCumAccuracy)DEFAULT_INVERSE_ABSOLUTE_ACCURACY).Creates a β distribution. |
| Modifier and Type | Method and Description |
|---|---|
| public double | cumulativeProbability(double
the point at which the CDF is evaluated x)Implements org. For a random variable |
| public double | density(double
the point at which the PDF is evaluated x)Implements org. Returns the probability density function (PDF) of this distribution
evaluated at the specified point |
| public double | |
| public double | |
| public double | getNumericalMean()
Implements org. Use this method to get the numerical value of the mean of this distribution. |
| public double | getNumericalVariance()
Implements org. Use this method to get the numerical value of the variance of this distribution. |
| protected double | Returns: the solver absolute accuracy.Overrides org. Return the absolute accuracy setting of the solver used to estimate inverse cumulative probabilities. |
| public double | Returns: lower bound of the support (always 0)Implements org. Access the lower bound of the support. |
| public double | Returns: upper bound of the support (always 1)Implements org. Access the upper bound of the support. |
| public boolean | Returns: trueImplements org. Use this method to get information about whether the support is connected, i.e. whether all values between the lower and upper bound of the support are included in the support. |
| public boolean | isSupportLowerBoundInclusive()
Implements org. Whether or not the lower bound of support is in the domain of the density function. |
| public boolean | isSupportUpperBoundInclusive()
Implements org. Whether or not the upper bound of support is in the domain of the density function. |
| public double | logDensity(double
the point at which the PDF is evaluated x)Overrides org. Returns the natural logarithm of the probability density function (PDF) of this distribution
evaluated at the specified point |
| private void | |
| public double | sample()
Overrides org. Implements org. Generate a random value sampled from this distribution. |
| alpha | back to summary |
|---|---|
| private final double alpha First shape parameter. | |
| beta | back to summary |
|---|---|
| private final double beta Second shape parameter. | |
| DEFAULT_INVERSE_ABSOLUTE_ACCURACY | back to summary |
|---|---|
| public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY Default inverse cumulative probability accuracy.
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serializable version identifier. | |
| solverAbsoluteAccuracy | back to summary |
|---|---|
| private final double solverAbsoluteAccuracy Hides org. Inverse cumulative probability accuracy. | |
| z | back to summary |
|---|---|
| private double z Normalizing factor used in density computations. updated whenever alpha or beta are changed. | |
| BetaDistribution | back to summary |
|---|---|
| public BetaDistribution(double alpha, double beta) Build a new instance. Note this constructor will implicitly create an instance of
| |
| BetaDistribution | back to summary |
|---|---|
| public BetaDistribution(double alpha, double beta, double inverseCumAccuracy) Build a new instance. Note this constructor will implicitly create an instance of
| |
| BetaDistribution | back to summary |
|---|---|
| public BetaDistribution(RandomGenerator rng, double alpha, double beta) Creates a β distribution.
| |
| BetaDistribution | back to summary |
|---|---|
| public BetaDistribution(RandomGenerator rng, double alpha, double beta, double inverseCumAccuracy) Creates a β distribution.
| |
| cumulativeProbability | back to summary |
|---|---|
| public double cumulativeProbability(double x) Implements org. Doc from org. For a random variable
| |
| density | back to summary |
|---|---|
| public double density(double x) Implements org. Doc from org. Returns the probability density function (PDF) of this distribution
evaluated at the specified point
| |
| getAlpha | back to summary |
|---|---|
| public double getAlpha() Access the first shape parameter,
| |
| getBeta | back to summary |
|---|---|
| public double getBeta() Access the second shape parameter,
| |
| getNumericalMean | back to summary |
|---|---|
| public double getNumericalMean() Implements org. Doc from org. Use this method to get the numerical value of the mean of this
distribution.
For first shape parameter
| |
| getNumericalVariance | back to summary |
|---|---|
| public double getNumericalVariance() Implements org. Doc from org. Use this method to get the numerical value of the variance of this
distribution.
For first shape parameter
| |
| getSolverAbsoluteAccuracy | back to summary |
|---|---|
| protected double getSolverAbsoluteAccuracy() Overrides org. Return the absolute accuracy setting of the solver used to estimate inverse cumulative probabilities.
| |
| getSupportLowerBound | back to summary |
|---|---|
| public double getSupportLowerBound() Implements org. Doc from org. Access the lower bound of the support. This method must return the same
value as
| |
| getSupportUpperBound | back to summary |
|---|---|
| public double getSupportUpperBound() Implements org. Doc from org. Access the upper bound of the support. This method must return the same
value as
| |
| isSupportConnected | back to summary |
|---|---|
| public boolean isSupportConnected() Implements org. Doc from org. Use this method to get information about whether the support is connected, i.e. whether all values between the lower and upper bound of the support are included in the support. The support of this distribution is connected.
| |
| isSupportLowerBoundInclusive | back to summary |
|---|---|
| public boolean isSupportLowerBoundInclusive() Implements org. Doc from org. Whether or not the lower bound of support is in the domain of the density
function. Returns true iff
| |
| isSupportUpperBoundInclusive | back to summary |
|---|---|
| public boolean isSupportUpperBoundInclusive() Implements org. Doc from org. Whether or not the upper bound of support is in the domain of the density
function. Returns true iff
| |
| logDensity | back to summary |
|---|---|
| public double logDensity(double x) Overrides org. Doc from org. Returns the natural logarithm of the probability density function (PDF) of this distribution
evaluated at the specified point
| |
| recomputeZ | back to summary |
|---|---|
| private void recomputeZ() Recompute the normalization factor. | |
| sample | back to summary |
|---|---|
| public double sample() Overrides org. Implements org. Doc from org. Generate a random value sampled from this distribution. The default implementation uses the inversion method. Sampling is performed using Cheng algorithms: R. C. H. Cheng, "Generating beta variates with nonintegral shape parameters.". Communications of the ACM, 21, 317–322, 1978.
| |
R. C. H. Cheng, "Generating beta variates with nonintegral shape parameters.". Communications of the ACM, 21, 317–322, 1978.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static double | Returns: sampled valuerandom generator to use random, final double distribution first shape parameter (α) a0, final double min(α, β) where α, β are the two distribution shape parameters a, final double max(α, β) where α, β are the two distribution shape parameters b)Returns one sample using Cheng's BB algorithm, when both α and β are greater than 1. |
| private static double | Returns: sampled valuerandom generator to use random, final double distribution first shape parameter (α) a0, final double max(α, β) where α, β are the two distribution shape parameters a, final double min(α, β) where α, β are the two distribution shape parameters b)Returns one sample using Cheng's BC algorithm, when at least one of α and β is smaller than 1. |
| pack-priv static double | Returns: sampled valuerandom generator to use random, final double distribution first shape parameter alpha, final double distribution second shape parameter beta)Returns one sample using Cheng's sampling algorithm. |
| ChengBetaSampler | back to summary |
|---|---|
| private ChengBetaSampler() | |
| algorithmBB | back to summary |
|---|---|
| private static double algorithmBB(RandomGenerator random, final double a0, final double a, final double b) Returns one sample using Cheng's BB algorithm, when both α and β are greater than 1.
| |
| algorithmBC | back to summary |
|---|---|
| private static double algorithmBC(RandomGenerator random, final double a0, final double a, final double b) Returns one sample using Cheng's BC algorithm, when at least one of α and β is smaller than 1.
| |
| sample | back to summary |
|---|---|
| pack-priv static double sample(RandomGenerator random, final double alpha, final double beta) Returns one sample using Cheng's sampling algorithm.
| |